Files
joakim ec0c06d491 handy: hide force-shown windows at boot
Handy ignores --start-hidden whenever the tray icon is disabled: without
a tray it force-shows the main window as the only way back in
(lib.rs: `if should_force_show || !should_hide || !tray_available`).
Since both instances run tray-less (GUI access is via the SUPER+G /
SUPER+SHIFT+G binds instead), both windows opened on workspace 1 at
every boot.

Add handy-boot-hide: polls for the first two Handy windows after boot
and dispatches a close on each — Handy intercepts close and hides the
window instead of quitting, which is exactly the hidden state
--start-hidden would have produced. Wired into the Hyprland autostart
after both instances launch.

Note: the Lua config provider parses `hyprctl dispatch` args as a Lua
expression, so the script uses the dispatcher form
`hl.dsp.window.close({ window = 'address:…' })`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016vLKT7j9KJEsJ4mEVbGyqp
2026-08-15 02:59:28 +02:00

22 lines
929 B
Bash
Executable File

#!/usr/bin/env bash
# Handy force-shows its main window at startup whenever the tray icon is
# disabled (lib.rs: "If start_hidden but tray is disabled, we must show
# the window anyway" — it can't know the SUPER+G/SHIFT+G binds are the
# way back in). So --start-hidden alone can't keep the two instances
# hidden at boot. Instead: watch for the first two Handy windows and
# dispatch a close — Handy intercepts close and hides the window.
set -euo pipefail
hidden=0
for _ in $(seq 1 150); do # ~30 s window after boot
while read -r addr; do
# Lua-form dispatch: the Lua config provider parses hyprctl
# dispatch args as a Lua expression.
hyprctl dispatch "hl.dsp.window.close({ window = 'address:$addr' })" >/dev/null
hidden=$((hidden + 1))
done < <(hyprctl clients -j | jq -r '.[] | select(.class == "handy") | .address')
[ "$hidden" -ge 2 ] && exit 0
sleep 0.2
done
exit 0