install: make the Hyprland reload work from SSH / TTY too

Previous reload step was gated on $HYPRLAND_INSTANCE_SIGNATURE being
set in the environment. If you ran the installer from outside the
Hyprland session (SSH, TTY, a non-graphical shell) the reload silently
skipped and windowrules weren't picked up until the next Hyprland
restart — which is why a test install on another box had the app
opening fullscreen instead of floating + centered.

Now the script:

* Falls back to picking a live instance from $XDG_RUNTIME_DIR/hypr/ if
  the env var isn't set — so hyprctl reload works even from SSH.
* Always runs a best-effort `touch` on windows.conf so Hyprland's
  inotify-based auto-reload picks up the change even if the explicit
  reload was somehow a no-op.
* Prints a clear "run `hyprctl reload` manually" hint in the success
  summary so users who see the fullscreen-by-mistake behaviour know
  the one-command fix without reading source.

Verified on this machine: after `bash install.sh`, the running window
reports floating=True fullscreen=0 size=[1280,880] via hyprctl clients.
This commit is contained in:
28allday 2026-04-22 18:46:15 +01:00
parent f8f012e5a5
commit b6e741da02

View file

@ -299,12 +299,44 @@ windowrule = size 1280 880, match:class ^(dev\\.nocoder\\.NoCoder)$
$MARK_END $MARK_END
EOF EOF
if command -v hyprctl >/dev/null 2>&1 && [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then # Pick up the new windowrules. Hyprland auto-reloads on file save in most
say "Reloading Hyprland" # cases, but an atomic `mv` over the existing file can miss the inotify
hyprctl reload >/dev/null # watcher on some setups — plus the user might have run this from SSH/TTY
# where $HYPRLAND_INSTANCE_SIGNATURE isn't set. So we try every angle:
#
# 1. Find the live Hyprland instance socket (works from SSH too — we only
# need *any* one running session for this user).
# 2. Explicit `hyprctl -i $inst reload`; silent no-op if nothing's running.
# 3. Touch the conf so Hyprland's file watcher fires even if reload was
# missed.
#
# If all three fail (e.g. Hyprland isn't running at all), the rules will
# take effect next time Hyprland starts — still correct, just not instant.
if command -v hyprctl >/dev/null 2>&1; then
HYPR_INST=""
if [[ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
HYPR_INST="$HYPRLAND_INSTANCE_SIGNATURE"
else else
warn "hyprctl unavailable or Hyprland not running — rules will load on next session." # Pick the first live instance socket from $XDG_RUNTIME_DIR/hypr/.
hypr_root="${XDG_RUNTIME_DIR:-/run/user/$UID}/hypr"
shopt -s nullglob
for sock in "$hypr_root"/*/.socket.sock; do
inst_dir="${sock%/.socket.sock}"
HYPR_INST="${inst_dir##*/}"
break
done
shopt -u nullglob
fi fi
if [[ -n "$HYPR_INST" ]]; then
say "Reloading Hyprland (instance $HYPR_INST)"
HYPRLAND_INSTANCE_SIGNATURE="$HYPR_INST" hyprctl reload >/dev/null 2>&1 || warn "hyprctl reload returned an error — try 'hyprctl reload' manually if rules don't take effect."
else
warn "No running Hyprland instance detected — windowrules will load on next Hyprland session."
fi
fi
# Belt-and-braces: update mtime so Hyprland's inotify-based auto-reload
# notices the change if the explicit reload above was somehow a no-op.
touch "$HYPR_CONF" 2>/dev/null || true
# Walker caches its app list — restart so new installs show up immediately. # Walker caches its app list — restart so new installs show up immediately.
# (Omarchy ships a helper that restarts elephant.service + walker in one go.) # (Omarchy ships a helper that restarts elephant.service + walker in one go.)
@ -323,6 +355,11 @@ ${GREEN}NO-CODER installed.${RESET}
${DIM}${RESET} Windowrules appended to $HYPR_CONF ${DIM}${RESET} Windowrules appended to $HYPR_CONF
Open the walker (Super+Space) and search for "NO-CODER". Open the walker (Super+Space) and search for "NO-CODER".
If the window opens fullscreen instead of floating centered at 1280×880,
the Hyprland reload didn't pick up our rules — run this once to fix:
hyprctl reload
Your git clone is no longer needed — feel free to delete it, or keep it to Your git clone is no longer needed — feel free to delete it, or keep it to
'git pull && bash install.sh' for updates. 'git pull && bash install.sh' for updates.
EOF EOF