Add spinning donut screensaver with matrix rain

Terminal screensaver written in C, triggered by tmux lock-after-time
(180s idle), bind S, or `donut` alias. Features:

- Spinning torus with precomputed trig tables, randomized rotation
- Matrix rain overlay — donut luminance colors the rain characters
- 64-shade teal foreground palette with gradual dimming over time
- Chunky 7x5 clock with shadow, blinking colon, periodic drift
- Activity time display below clock (read from heartbeat state file)
- Rim lighting and ambient occlusion on donut edges
- RLE escape state machine — only emits SGR on shade transitions
- Row-skip rendering — empty/leading/trailing regions use cursor jumps
- Projection runs at adaptive rate (24fps bright, 6fps dim)
- select()-based frame pacing, deep sleep after 2hr (1fps)
- Resume detection — flushes stale PTY output after sleep/lock
- Mouse click to quit (SGR + X11 protocols, release filtered)
- write_all() retries partial writes, SIGPIPE handled gracefully
- Alternate screen buffer preserves shell scrollback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-27 16:56:44 +00:00
parent 5578bbd31f
commit e686b6396d
5 changed files with 692 additions and 0 deletions

View File

@@ -58,6 +58,9 @@ bind a last-window
# Reload
bind r source-file ~/.tmux.conf \; display "Config reloaded"
# Screensaver
bind S lock-session
# Status bar
set -g status-position bottom
set -g status-interval 1
@@ -83,6 +86,10 @@ set -g display-panes-active-colour "#2CB494"
# Clock
set -g clock-mode-colour "#2CB494"
# Screensaver
set -g lock-after-time 180
set -g lock-command 'eval $(grep active_total ${TMPDIR:-/tmp}/.tmux_heartbeat 2>/dev/null); ~/.tmux/donut ${active_total:-0}'
set -g automatic-rename on
set -g allow-rename off
set -g automatic-rename-format '#(~/.tmux/tab-name.sh "#{pane_current_command}" "#{b:pane_current_path}")'