From e87d4207b2e5c639d0070f7cdf989f97ab298d0f Mon Sep 17 00:00:00 2001 From: kenji Date: Fri, 2 Jan 2026 14:13:21 -0600 Subject: [PATCH] add(ghostty): screensaver! --- apps/ghostty/default.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/apps/ghostty/default.nix b/apps/ghostty/default.nix index 31db130..65a1579 100644 --- a/apps/ghostty/default.nix +++ b/apps/ghostty/default.nix @@ -3,6 +3,38 @@ pkgs, ... }: { + home.packages = [ + (pkgs.writeShellScriptBin "tte-loop" '' + trap 'tput cnorm; exit 0' INT + tput civis + effects=(beams binarypath blackhole bouncyballs bubbles burn colorshift crumble decrypt errorcorrect expand fireworks highlight laseretch matrix middleout orbittingvolley overflow pour print rain randomsequence rings scattered slice slide spotlights spray swarm sweep synthgrid unstable vhstape waves wipe) + while true; do + clear + cols=$(tput cols) + lines=$(tput lines) + effect="''${effects[RANDOM % ''${#effects[@]}]}" + ${pkgs.terminaltexteffects}/bin/tte --input-file ${config.home.homeDirectory}/.config/nixos/assets/branding.txt --anchor-canvas c --anchor-text c --canvas-width "$cols" --canvas-height "$((lines-1))" --frame-rate 120 "$effect" + tput civis + sleep 2 + done + '') + (pkgs.writeShellScriptBin "tte-screensaver" '' + # Start ghostty in background + ${pkgs.ghostty}/bin/ghostty --config-file=${config.home.homeDirectory}/.config/ghostty/screensaver --fullscreen -e tte-loop & + ghostty_pid=$! + + # Wait a moment for ghostty to start + sleep 0.5 + + # Monitor for any input and exit when detected + ${pkgs.libinput}/bin/libinput debug-events 2>/dev/null | head -n 1 >/dev/null + + # Input detected, kill ghostty + kill $ghostty_pid 2>/dev/null + wait $ghostty_pid 2>/dev/null + '') + ]; + home.file.".config/ghostty/screensaver".text = '' window-padding-x = 0 window-padding-y = 0