fix(screensaver): fix shifting issue on tte-loop

This commit is contained in:
kenji
2026-01-03 09:35:26 -06:00
parent aaa635f25e
commit 40efab98b9
+15 -8
View File
@@ -6,21 +6,29 @@
home.packages = [ home.packages = [
# TODO: will rewrite later # TODO: will rewrite later
(pkgs.writeShellScriptBin "tte-loop" '' (pkgs.writeShellScriptBin "tte-loop" ''
trap 'printf "\e[?25h"; exit 0' INT trap '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) 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 while true; do
clear clear
cols=$(tput cols)
lines=$(tput lines) lines=$(tput lines)
effect="''${effects[RANDOM % ''${#effects[@]}]}" 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 0 --canvas-height "$((lines - 2))" --frame-rate 240 "$effect"
${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 sleep 2
done done
'') '')
(pkgs.writeShellScriptBin "tte-screensaver" '' (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 # Get all monitors
monitors=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name') 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 # Monitor for any input and exit when detected
${pkgs.libinput}/bin/libinput debug-events 2>/dev/null | head -n 1 >/dev/null ${pkgs.libinput}/bin/libinput debug-events 2>/dev/null | head -n 1 >/dev/null
# Input detected, kill all screensaver instances exit_screensaver
${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop"
'') '')
]; ];