fix(screensaver): finally works
This commit is contained in:
+15
-11
@@ -5,33 +5,37 @@
|
|||||||
}: {
|
}: {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeShellScriptBin "tte-loop" ''
|
(pkgs.writeShellScriptBin "tte-loop" ''
|
||||||
trap 'tput cnorm; exit 0' INT
|
trap 'printf "\e[?25h"; exit 0' INT
|
||||||
tput civis
|
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)
|
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 "$cols" --canvas-height "$((lines-1))" --frame-rate 120 "$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-1))" --frame-rate 120 "$effect"
|
||||||
tput civis
|
printf '\e[?25l'
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
'')
|
'')
|
||||||
(pkgs.writeShellScriptBin "tte-screensaver" ''
|
(pkgs.writeShellScriptBin "tte-screensaver" ''
|
||||||
# Start ghostty in background
|
# Get all monitors
|
||||||
${pkgs.ghostty}/bin/ghostty --config-file=${config.home.homeDirectory}/.config/ghostty/screensaver --fullscreen -e tte-loop &
|
monitors=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name')
|
||||||
ghostty_pid=$!
|
|
||||||
|
|
||||||
# Wait a moment for ghostty to start
|
# Launch ghostty on each monitor one at a time
|
||||||
sleep 0.5
|
for monitor in $monitors; do
|
||||||
|
${pkgs.hyprland}/bin/hyprctl dispatch focusmonitor "$monitor"
|
||||||
|
sleep 0.3
|
||||||
|
${pkgs.ghostty}/bin/ghostty --config-file=${config.home.homeDirectory}/.config/ghostty/screensaver --fullscreen -e tte-loop &
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
# 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 ghostty
|
# Input detected, kill all screensaver instances
|
||||||
kill $ghostty_pid 2>/dev/null
|
${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop"
|
||||||
wait $ghostty_pid 2>/dev/null
|
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
"float, class:^(org\.gnome\.Loupe)$"
|
"float, class:^(org\.gnome\.Loupe)$"
|
||||||
"center, class:^(org\.gnome\.Loupe)$"
|
"center, class:^(org\.gnome\.Loupe)$"
|
||||||
"size 70% 70%, class:^(org\.gnome\.Loupe)$"
|
"size 70% 70%, class:^(org\.gnome\.Loupe)$"
|
||||||
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user