From 354c2f006075c5c471a5758601a0a87966469923 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 10 Aug 2026 13:59:20 +0200 Subject: [PATCH] Wait for the terminal resize before the first screensaver effect Co-Authored-By: Claude Opus 5 --- bin/omarchy-screensaver | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/omarchy-screensaver b/bin/omarchy-screensaver index c319234a..acd38683 100755 --- a/bin/omarchy-screensaver +++ b/bin/omarchy-screensaver @@ -22,6 +22,19 @@ hyprctl eval 'hl.config({ cursor = { invisible = true } })' &>/dev/null || hyprc tty=$(tty 2>/dev/null) +# Terminals allocate the pty at the default 80x24 and only resize it once the +# compositor has told the window how big it is. ttfx measures the terminal once, +# at startup, so starting it before the resize lands sizes an 80x24 canvas and +# paints it into the corner of a fullscreen window. +wait_for_terminal_resize() { + local deadline=$((SECONDS + 2)) + while ((SECONDS < deadline)) && [[ $(stty size 2>/dev/null) == "24 80" ]]; do + sleep 0.02 + done +} + +wait_for_terminal_resize + while true; do ttfx -i ~/.config/omarchy/branding/screensaver.txt \ --frame-rate 120 --canvas-width 0 --canvas-height 0 --reuse-canvas --anchor-canvas c --anchor-text c\