omarchy/bin/omarchy-cmd-screensaver
David Heinemeier Hansson ff6802830c Correct the path
2025-08-24 21:04:52 +02:00

31 lines
864 B
Bash
Executable File

#!/bin/bash
if command -v tte &>/dev/null; then
while true; do
effect=$(tte 2>&1 | grep -oP '{\K[^}]+' | tr ',' ' ' | tr ' ' '\n' | sed -n '/^beams$/,$p' | sort -u | shuf -n1)
tte -i ~/.config/omarchy/branding/screensaver.txt \
--frame-rate 240 --canvas-width 0 --canvas-height $(($(tput lines) - 2)) --anchor-canvas c --anchor-text c \
"$effect" &
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
fi
done
done
else
# Poor man's screensaver in case we don't have tte
clear
while true; do
echo -e "\033[32m"
cat ~/.config/omarchy/branding/screensaver.txt
echo -e "\033[0m"
echo
# Wait up to 2 seconds, quit if any key is pressed
read -t 2 -n 1 key && break
done
fi