Files
omarchy/bin/omarchy-cmd-screensaver
2025-11-21 13:46:51 -05:00

31 lines
791 B
Bash
Executable File

#!/bin/bash
screensaver_in_focus() {
hyprctl activewindow -j | jq -e '.class == "org.omarchy.screensaver"' >/dev/null 2>&1
}
exit_screensaver() {
hyprctl keyword cursor:invisible false
pkill -x tte 2>/dev/null
pkill -f org.omarchy.screensaver 2>/dev/null
exit 0
}
trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT
printf '\033]11;rgb:00/00/00\007' # Set background color to black
hyprctl keyword cursor:invisible true &>/dev/null
while true; do
tte -i ~/.config/omarchy/branding/screensaver.txt \
--frame-rate 120 --canvas-width 0 --canvas-height 0 --anchor-canvas c --anchor-text c\
--no-eol --no-restore-cursor random_effect &
while pgrep -x tte >/dev/null; do
if read -n 1 -t 3 || ! screensaver_in_focus; then
exit_screensaver
fi
done
done