diff --git a/apps/ghostty/default.nix b/apps/ghostty/default.nix index e559964..dce2b37 100644 --- a/apps/ghostty/default.nix +++ b/apps/ghostty/default.nix @@ -6,29 +6,21 @@ home.packages = [ # TODO: will rewrite later (pkgs.writeShellScriptBin "tte-loop" '' - trap 'exit 0' INT + trap 'printf "\e[?25h"; exit 0' INT + printf '\e[?25l' 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 0 --canvas-height "$((lines - 2))" --frame-rate 240 "$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 "$cols" --canvas-height "$((lines-2))" --frame-rate 120 "$effect" + printf '\e[?25l' 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') @@ -43,7 +35,8 @@ # Monitor for any input and exit when detected ${pkgs.libinput}/bin/libinput debug-events 2>/dev/null | head -n 1 >/dev/null - exit_screensaver + # Input detected, kill all screensaver instances + ${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop" '') ];