diff --git a/bin/omarchy-cmd-screensaver b/bin/omarchy-cmd-screensaver index eb32060..21eaa0a 100755 --- a/bin/omarchy-cmd-screensaver +++ b/bin/omarchy-cmd-screensaver @@ -1,4 +1,11 @@ #!/bin/bash +function exit_screensaver { + pkill -x tte 2>/dev/null + pkill -f "alacritty --class Screensaver" 2>/dev/null + exit 0 +} + +trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT while true; do effect=$(tte 2>&1 | grep -oP '{\K[^}]+' | tr ',' ' ' | tr ' ' '\n' | sed -n '/^beams$/,$p' | sort -u | shuf -n1) @@ -8,9 +15,7 @@ while true; do while pgrep -x tte >/dev/null; do if read -n 1 -t 0.01; then - pkill -x tte 2>/dev/null - pkill -f "alacritty --class Screensaver" 2>/dev/null - exit 0 + exit_screensaver fi done done