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\