From 06d61be018118523de88c04e3925dd3f2a91a32b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 1 Aug 2025 16:05:04 +0200 Subject: [PATCH] Try to protect the screensaver from missing tte or pip --- bin/omarchy-cmd-screensaver | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/bin/omarchy-cmd-screensaver b/bin/omarchy-cmd-screensaver index 03fd1a6..8240023 100755 --- a/bin/omarchy-cmd-screensaver +++ b/bin/omarchy-cmd-screensaver @@ -2,9 +2,22 @@ trap "exit" SIGINT -while true; do - effect=$(tte 2>&1 | grep -oP '{\K[^}]+' | tr ',' ' ' | tr ' ' '\n' | sed -n '/^beams$/,$p' | sort -u | shuf -n1) - tte -i ~/.local/share/omarchy/logo.txt \ - --frame-rate 240 --canvas-width 0 --canvas-height 0 --anchor-canvas c --anchor-text c \ - "$effect" -done +screensaver() { + while true; do + effect=$(tte 2>&1 | grep -oP '{\K[^}]+' | tr ',' ' ' | tr ' ' '\n' | sed -n '/^beams$/,$p' | sort -u | shuf -n1) + tte -i ~/.local/share/omarchy/logo.txt \ + --frame-rate 240 --canvas-width 0 --canvas-height 0 --anchor-canvas c --anchor-text c \ + "$effect" + done +} + +if command -v tte &>/dev/null; then + screensaver +else + if command -v pip &>/dev/null; then + pip install terminaltexteffects + screensaver + else + gum spin --title "Can't find tte or pip. Install pip, then try: pip install terminaltexteffects" -- sleep 2 + fi +fi