Pause Hyprland reloads during settings updates
This commit is contained in:
@@ -127,12 +127,18 @@ for source, destination, legacy in package_defaults:
|
||||
if destination and (source not in pkgbuild or destination not in pkgbuild):
|
||||
errors.append(f"PKGBUILD does not explicitly install {source} -> {destination}")
|
||||
|
||||
guard_hook = "default/libalpm/hooks/00-omarchy-update-guard.hook"
|
||||
guard_destination = "/usr/share/libalpm/hooks/00-omarchy-update-guard.hook"
|
||||
if not (root / guard_hook).exists():
|
||||
errors.append(f"missing package default source: {guard_hook}")
|
||||
if guard_hook not in omarchy_pkgbuild or guard_destination not in omarchy_pkgbuild:
|
||||
errors.append(f"omarchy PKGBUILD does not install {guard_hook} -> {guard_destination}")
|
||||
alpm_hooks = [
|
||||
"00-omarchy-update-guard.hook",
|
||||
"10-omarchy-hyprland-reload-pause.hook",
|
||||
"90-omarchy-hyprland-reload-resume.hook",
|
||||
]
|
||||
for hook in alpm_hooks:
|
||||
source = f"default/libalpm/hooks/{hook}"
|
||||
destination = f"/usr/share/libalpm/hooks/{hook}"
|
||||
if not (root / source).exists():
|
||||
errors.append(f"missing package default source: {source}")
|
||||
if source not in omarchy_pkgbuild or destination not in omarchy_pkgbuild:
|
||||
errors.append(f"omarchy PKGBUILD does not install {source} -> {destination}")
|
||||
|
||||
if errors:
|
||||
print("\n".join(errors), file=sys.stderr)
|
||||
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$0")/base-test.sh"
|
||||
|
||||
test_tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$test_tmp"' EXIT
|
||||
|
||||
run_root="$test_tmp/run-user"
|
||||
state_dir="$test_tmp/state"
|
||||
hyprctl_log="$test_tmp/hyprctl.log"
|
||||
fake_hyprctl="$test_tmp/hyprctl"
|
||||
signature="test-signature"
|
||||
runtime_dir="$run_root/1000"
|
||||
|
||||
mkdir -p "$runtime_dir/hypr/$signature"
|
||||
|
||||
cat >"$fake_hyprctl" <<'BASH'
|
||||
#!/bin/bash
|
||||
|
||||
printf '%s\t%s\t%s\n' "$XDG_RUNTIME_DIR" "$HYPRLAND_INSTANCE_SIGNATURE" "$*" >>"$FAKE_HYPRCTL_LOG"
|
||||
|
||||
case "$*" in
|
||||
*'getoption misc.disable_autoreload'*)
|
||||
printf '{"option":"misc.disable_autoreload","bool":%s,"set":true}\n' "${FAKE_DISABLE_AUTORELOAD:-false}"
|
||||
;;
|
||||
*'getoption debug.suppress_errors'*)
|
||||
printf '{"option":"debug.suppress_errors","bool":%s,"set":true}\n' "${FAKE_SUPPRESS_ERRORS:-false}"
|
||||
;;
|
||||
*)
|
||||
printf 'ok\n'
|
||||
;;
|
||||
esac
|
||||
BASH
|
||||
chmod 0755 "$fake_hyprctl"
|
||||
|
||||
FAKE_HYPRCTL_LOG="$hyprctl_log" \
|
||||
HYPRCTL="$fake_hyprctl" \
|
||||
OMARCHY_HYPRLAND_RELOAD_GUARD_RUN_ROOT="$run_root" \
|
||||
OMARCHY_HYPRLAND_RELOAD_GUARD_STATE_DIR="$state_dir" \
|
||||
"$ROOT/bin/omarchy-hyprland-reload-guard" pause
|
||||
|
||||
state_file="$state_dir/$signature"
|
||||
[[ -f $state_file ]] || fail "reload guard stores Hyprland state on pause"
|
||||
grep -Fx $'1000 false false' "$state_file" >/dev/null || fail "reload guard records previous Hyprland reload settings"
|
||||
grep -F 'hl.config({ misc = { disable_autoreload = true }, debug = { suppress_errors = true } })' "$hyprctl_log" >/dev/null || fail "reload guard pauses autoreload with hyprctl eval"
|
||||
pass "reload guard pauses live Hyprland reloads"
|
||||
|
||||
: >"$hyprctl_log"
|
||||
FAKE_HYPRCTL_LOG="$hyprctl_log" \
|
||||
HYPRCTL="$fake_hyprctl" \
|
||||
OMARCHY_HYPRLAND_RELOAD_GUARD_RUN_ROOT="$run_root" \
|
||||
OMARCHY_HYPRLAND_RELOAD_GUARD_STATE_DIR="$state_dir" \
|
||||
"$ROOT/bin/omarchy-hyprland-reload-guard" resume
|
||||
|
||||
[[ ! -e $state_file ]] || fail "reload guard clears Hyprland state after resume"
|
||||
grep -F $'test-signature --instance test-signature reload' "$hyprctl_log" >/dev/null || fail "reload guard forces one Hyprland reload after package transaction"
|
||||
grep -F 'hl.config({ misc = { disable_autoreload = false }, debug = { suppress_errors = false } })' "$hyprctl_log" >/dev/null || fail "reload guard restores previous Hyprland reload settings"
|
||||
pass "reload guard resumes live Hyprland reloads"
|
||||
Reference in New Issue
Block a user