From 599b58f9a1b2383852695caf3308db27df2581c3 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 24 Aug 2025 22:24:42 +0200 Subject: [PATCH] Prepare for tte's imminent return! --- bin/omarchy-cmd-screensaver | 26 ++++++++++++-------------- bin/omarchy-launch-screensaver | 5 +++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/bin/omarchy-cmd-screensaver b/bin/omarchy-cmd-screensaver index 2f105862..eb320600 100755 --- a/bin/omarchy-cmd-screensaver +++ b/bin/omarchy-cmd-screensaver @@ -1,18 +1,16 @@ #!/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 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 + 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 -fi +done diff --git a/bin/omarchy-launch-screensaver b/bin/omarchy-launch-screensaver index 2ad91f0b..d1ccd255 100755 --- a/bin/omarchy-launch-screensaver +++ b/bin/omarchy-launch-screensaver @@ -1,5 +1,10 @@ #!/bin/bash +# Exit early if we don't have the tte show +if ! command -v tte &>/dev/null; then + exit 0 +fi + # Exit early if screensave is already running pgrep -f "alacritty --class Screensaver" && exit 0