From 40efab98b94a59ad00ada04d60b00cd0e2af0862 Mon Sep 17 00:00:00 2001 From: kenji Date: Sat, 3 Jan 2026 09:35:26 -0600 Subject: [PATCH] fix(screensaver): fix shifting issue on tte-loop --- apps/ghostty/default.nix | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/ghostty/default.nix b/apps/ghostty/default.nix index dce2b37..e559964 100644 --- a/apps/ghostty/default.nix +++ b/apps/ghostty/default.nix @@ -6,21 +6,29 @@ home.packages = [ # TODO: will rewrite later (pkgs.writeShellScriptBin "tte-loop" '' - trap 'printf "\e[?25h"; exit 0' INT - printf '\e[?25l' + trap 'exit 0' INT 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[@]}]}" - printf '\e[?25l' - ${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-2))" --frame-rate 120 "$effect" - printf '\e[?25l' + ${pkgs.terminaltexteffects}/bin/tte --input-file ${config.home.homeDirectory}/.config/nixos/assets/branding.txt --anchor-canvas c --anchor-text c --canvas-width 0 --canvas-height "$((lines - 2))" --frame-rate 240 "$effect" sleep 2 done '') (pkgs.writeShellScriptBin "tte-screensaver" '' + exit_screensaver() { + ${pkgs.hyprland}/bin/hyprctl keyword cursor:inactive_timeout 0 + ${pkgs.procps}/bin/pkill -x tte 2>/dev/null + ${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop" 2>/dev/null + exit 0 + } + + trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT + + # Hide cursor + ${pkgs.hyprland}/bin/hyprctl keyword cursor:inactive_timeout 1 + # Get all monitors monitors=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name') @@ -35,8 +43,7 @@ # 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 all screensaver instances - ${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop" + exit_screensaver '') ];