Fix tiled fullscreen toggle

This commit is contained in:
David Heinemeier Hansson
2026-05-29 15:59:13 +02:00
parent 6f0d9d53cd
commit a4bb7a46f1
3 changed files with 56 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
# omarchy:summary=Toggle tiled fullscreen for the focused Hyprland window
set -euo pipefail
active=$(hyprctl activewindow -j)
fullscreen_client=$(jq -r '.fullscreenClient // 0' <<<"$active")
if [[ $fullscreen_client == "2" ]]; then
hyprctl dispatch 'hl.dsp.window.fullscreen_state({ internal = 0, client = 0 })' >/dev/null 2>&1 || \
hyprctl dispatch fullscreenstate 0 0 >/dev/null
else
hyprctl dispatch 'hl.dsp.window.fullscreen_state({ internal = 0, client = 2 })' >/dev/null 2>&1 || \
hyprctl dispatch fullscreenstate 0 2 >/dev/null
fi
+1 -1
View File
@@ -5,7 +5,7 @@ o.bind("SUPER + J", "Toggle window split", hl.dsp.layout("togglesplit"))
o.bind("SUPER + P", "Pseudo window", hl.dsp.window.pseudo())
o.bind("SUPER + T", "Toggle window floating/tiling", hl.dsp.window.float({ action = "toggle" }))
o.bind("SUPER + F", "Full screen", hl.dsp.window.fullscreen({ mode = "fullscreen" }))
o.bind("SUPER + CTRL + F", "Tiled full screen", hl.dsp.window.fullscreen_state({ internal = 0, client = 2 }))
o.bind("SUPER + CTRL + F", "Tiled full screen", "omarchy-hyprland-window-tiled-fullscreen-toggle")
o.bind("SUPER + ALT + F", "Full width", hl.dsp.window.fullscreen({ mode = "maximized" }))
o.bind("SUPER + O", "Pop window out (float & pin)", "omarchy-hyprland-window-pop")
o.bind("SUPER + ALT + Home", "Save window width", "omarchy-hyprland-window-width save")
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
source "$(dirname "$0")/base-test.sh"
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
cat >"$tmpdir/hyprctl" <<'BASH'
#!/bin/bash
if [[ $1 == "activewindow" && $2 == "-j" ]]; then
printf '{"fullscreenClient":%s}\n' "${HYPR_FULLSCREEN_CLIENT:-0}"
exit 0
fi
if [[ $1 == "dispatch" ]]; then
printf '%s\n' "$*" >>"$HYPRCTL_LOG"
exit 0
fi
exit 1
BASH
chmod +x "$tmpdir/hyprctl"
log="$tmpdir/hyprctl.log"
PATH="$tmpdir:$PATH" HYPRCTL_LOG="$log" HYPR_FULLSCREEN_CLIENT=0 \
"$ROOT/bin/omarchy-hyprland-window-tiled-fullscreen-toggle"
grep -Fq 'hl.dsp.window.fullscreen_state({ internal = 0, client = 2 })' "$log" || \
fail "tiled fullscreen enables client fullscreen"
pass "tiled fullscreen enables client fullscreen"
>"$log"
PATH="$tmpdir:$PATH" HYPRCTL_LOG="$log" HYPR_FULLSCREEN_CLIENT=2 \
"$ROOT/bin/omarchy-hyprland-window-tiled-fullscreen-toggle"
grep -Fq 'hl.dsp.window.fullscreen_state({ internal = 0, client = 0 })' "$log" || \
fail "tiled fullscreen disables client fullscreen"
pass "tiled fullscreen disables client fullscreen"