Fix graceful window closing before reboot
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
hyprctl clients -j | \
|
hyprctl clients -j | \
|
||||||
jq -r ".[].address" | \
|
jq -r ".[].address" | \
|
||||||
while read -r addr; do
|
while read -r addr; do
|
||||||
hyprctl dispatch "hl.dsp.window.close(\"address:$addr\")" >/dev/null 2>&1 || hyprctl dispatch closewindow "address:$addr"
|
hyprctl dispatch "hl.dsp.window.close({ window = \"address:$addr\" })" >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
# Move to first workspace
|
# Move to first workspace
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "$(dirname "$0")/base-test.sh"
|
||||||
|
|
||||||
|
test_tmp=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$test_tmp"' EXIT
|
||||||
|
|
||||||
|
mock_bin="$test_tmp/bin"
|
||||||
|
hyprctl_log="$test_tmp/hyprctl.log"
|
||||||
|
mkdir -p "$mock_bin"
|
||||||
|
|
||||||
|
cat >"$mock_bin/hyprctl" <<'SH'
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ $1 == "clients" ]]; then
|
||||||
|
printf '[{"address":"0xabc"},{"address":"0xdef"}]\n'
|
||||||
|
else
|
||||||
|
printf '%s\n' "$*" >>"$HYPRCTL_LOG"
|
||||||
|
fi
|
||||||
|
SH
|
||||||
|
chmod +x "$mock_bin/hyprctl"
|
||||||
|
|
||||||
|
PATH="$mock_bin:$PATH" HYPRCTL_LOG="$hyprctl_log" "$ROOT/bin/omarchy-hyprland-window-close-all"
|
||||||
|
|
||||||
|
expected_log="$test_tmp/expected.log"
|
||||||
|
cat >"$expected_log" <<'EOF'
|
||||||
|
dispatch hl.dsp.window.close({ window = "address:0xabc" })
|
||||||
|
dispatch hl.dsp.window.close({ window = "address:0xdef" })
|
||||||
|
dispatch hl.dsp.focus({ workspace = "1" })
|
||||||
|
EOF
|
||||||
|
|
||||||
|
diff -u "$expected_log" "$hyprctl_log" || fail "close-all targets each window with the Lua dispatcher"
|
||||||
|
pass "close-all targets each window with the Lua dispatcher"
|
||||||
Reference in New Issue
Block a user