Skip to content

GreenScreen410/singularity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Singularity

A slowly drifting black hole that bends your entire Windows desktop like a real gravitational lens - as a single standalone app. No terminal, no external tools: run one executable and the hole wanders across your screen, warping whatever it passes over.

Inspired by ghostty-blackhole, but freed from Ghostty and Claude Code.

A black hole drifting across the desktop, lensing the windows around it

Features

  • Real physics - every pixel near the hole integrates its own null geodesic through the Schwarzschild metric (after Eric Bruneton's black-hole renderer, via ghostty-blackhole): a true shadow, an Einstein ring with mirrored secondary images, and a tilted Keplerian accretion disk whose far side arcs over and under the hole
  • Blackbody accretion disk - Shakura-Sunyaev temperature profile, relativistic Doppler shift and beaming, gravitational time dilation
  • 8 looks, switched live - Inferno, Gargantua, Quasar, M87* donut, Blazar, Face-on ember, Pure lens, Zen - pick from the tray menu, with a smooth crossfade (the original tuner's presets, exact values)
  • A real overlay - fullscreen, always-on-top, click-through; your apps keep working underneath while the hole warps them. The overlay excludes itself from capture, so there is no mirror-feedback
  • Place it anywhere - hold Ctrl+Shift and the hole follows your mouse; release to pin it in place. Tray: Position, or pin_x/pin_y in the config file; Auto drift resumes the wandering
  • Multi-monitor - the hole roams across all monitors by default, crossing boundaries seamlessly (one overlay and capture per monitor). Confine it to a single monitor from the tray or with monitor in the config file
  • Kerr mode - give the hole spin (tray: Spin, config: spin up to 0.98) and it integrates exact Kerr geodesics in Kerr-Schild coordinates instead of Schwarzschild: frame dragging displaces the shadow against the lensing, the ISCO shrinks so the disk hugs the hole, and the field twists asymmetrically. On top of the exact geometry sits a deliberately dramatized swirl layer, because the true twist is physically real but too subtle to read at desktop scale. Costs more GPU while nonzero
  • Screensaver mode - optionally appear only after N minutes without keyboard/mouse input, swelling out of nothing, and vanish on the first input (tray: Screensaver, or idle_minutes in the config file)
  • Update notice - once a day the app asks GitHub whether a newer release exists and, if so, adds an "Update available" entry to the tray menu that opens the releases page. That is the only network access it ever makes; set check_updates = 0 in the config file to disable it
  • Single self-contained exe - no runtime, no installer, ~8 MB

Build & run

Windows (primary platform, tested)

Requires Rust with the MSVC toolchain (the default on Windows) and Windows 10 2004+ / Windows 11.

cargo run --release

The overlay covers the screen, the hole drifts on its own, and clicks pass through to your apps. Switch the disk look from the tray icon (the ^ overflow area) - 8 presets from Inferno to Zen. Quit via the tray menu or Esc.

Cross-compiling from WSL also works: rustup target add x86_64-pc-windows-gnu, install mingw-w64, then cargo build --release --target x86_64-pc-windows-gnu.

macOS (UNTESTED - help wanted)

The macOS port (ScreenCaptureKit capture + NSWindowSharingNone self-exclusion

  • menu-bar presets) is structurally complete and kept type-checked via cargo check --target aarch64-apple-darwin, but has never run on real hardware - there is no Mac in this project's dev loop.
cargo run --release   # on a Mac

On first launch, grant Screen Recording permission (System Settings → Privacy & Security) and relaunch. If you try it, success or failure reports are equally welcome as issues.

Linux

Not yet - neither X11 nor Wayland offers a way to exclude a window from capture, so a live overlay feeds back into itself. A wallpaper-warp mode is the likely path; contributions welcome.

No-build alternative (ShaderGlass)

If you just want the effect over your desktop today without building anything, shaderglass/ contains the same lens as a shader for ShaderGlass: load shaderglass/singularity.slangp via Shader → Import custom with Input → Desktop and Output → Mode → Glass. This is the stop-gap; the standalone app above is the real goal.

How it works

The desktop is captured into a GPU texture and plays the role of the lensed "sky". For each pixel near the hole, the fragment shader integrates a photon geodesic in the Schwarzschild metric (leapfrog, adaptive step): rays under the critical impact parameter fall in (the shadow), escaping rays are projected back onto the sky plane (lensing, Einstein ring, mirrored images), and every crossing of the tilted disk plane accumulates blackbody emission shifted by the relativistic Doppler factor. Far from the hole an analytic weak-field formula takes over with a seamless handoff. The centre follows a slow Lissajous path so the hole drifts on its own.

Tuning: disk looks live in src/main.rs (PRESETS), size in HOLE_RADIUS, drift and integration budget in src/singularity.wgsl (DRIFT_*, N_STEPS).

Performance & battery

Capture is zero-copy on Windows: each desktop frame is GPU-copied straight into a shared D3D12 texture that the shader samples, so frames never touch the CPU (with an automatic CPU fallback for setups where sharing is not available). Only pixels near the hole pay for geodesic integration, frames are delivered only when the screen changes, and the tray offers an FPS cap. In screensaver mode the renderer is fully idle until the hole appears. It is still a continuous visual effect though, so expect some battery cost while the hole is on screen.

Screenshots and the capture exclusion

The overlay excludes itself from screen capture: it captures the desktop itself, and without that exclusion it would see its own output and collapse into an infinite mirror. That would normally keep the hole out of your screenshots, so Singularity fixes them instead: when a full-screen screenshot lands on the clipboard right after Print Screen, the hole is composited back into the image before you paste it. Region snips and files saved to disk are deliberately left untouched, and fix_screenshots = 0 in the config file turns the whole thing off. Screen recording picks the overlay up as-is (the demo above is a plain screen recording).

A note on Windows SmartScreen

Release binaries are not code-signed (certificates are priced for companies, not desk toys). The first launch of a downloaded exe may show "Windows protected your PC" - click More info → Run anyway, or build from source.

Credits

License

MIT - see LICENSE.

About

A drifting black hole that gravitationally lenses your desktop. Ray-traced Schwarzschild geodesics, live.

Topics

Resources

License

Stars

14 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors