From 0225b408ff2a0feba2f21ccebdd478eec7606da2 Mon Sep 17 00:00:00 2001 From: Marc Morriss Date: Sun, 6 Sep 2026 12:48:18 -0500 Subject: [PATCH] Make `omarchy toggle bar on` show the bar and `off` hide it The bar's flag is named for the off state, `bar-off`, and omarchy-toggle-bar passed the user-facing action straight through to omarchy-toggle. So `bar on` created the flag and hid the bar, and `bar off` removed it and revealed the bar: the reverse of the command's own summary and examples. The bare toggle was unaffected. Because the flag persists, the hidden state survives shell restarts and reboots, and shows up again after monitor hotplug when the bar re-reads it. Map the explicit actions the other way round before calling omarchy-toggle, pass a bare toggle through, and refuse anything else with a usage line. The IPC nudge after the flip is unchanged. toggle-test.sh asserted the inverted behavior, so its bar assertions now cover on, off, idempotence, both toggle spellings and a rejected action. The acceptance test from #9240 hid the bar with `on` and revealed it with `off`; those calls are swapped so it keeps proving the same layer behavior. Fixes #10357 Fixes #10044 Written by Claude Fable 5.1 via Claude Code, reviewed by Marc Morriss Co-Authored-By: Claude Fable 5.1 --- bin/omarchy-toggle-bar | 18 +++++++++++++++++- test/acceptance.d/session-test.sh | 6 +++--- test/shell.d/toggle-test.sh | 27 +++++++++++++++++++++------ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/bin/omarchy-toggle-bar b/bin/omarchy-toggle-bar index be18a647299..3d359a61297 100755 --- a/bin/omarchy-toggle-bar +++ b/bin/omarchy-toggle-bar @@ -4,7 +4,23 @@ # omarchy:args=[toggle|on|off] # omarchy:examples=omarchy toggle bar | omarchy toggle bar off | omarchy toggle bar on -omarchy-toggle bar-off "${1:-toggle}" +# The flag is named for the off state, so the user-facing on and off run the +# other way round: `bar on` lifts `bar-off` and `bar off` sets it. +case "${1:-toggle}" in + toggle) + omarchy-toggle bar-off + ;; + on) + omarchy-toggle bar-off off + ;; + off) + omarchy-toggle bar-off on + ;; + *) + echo "Usage: omarchy-toggle-bar [toggle|on|off]" >&2 + exit 1 + ;; +esac # The shell's watch on the toggles directory can miss flag changes that land in # quick succession, stranding the bar off screen until the shell restarts. diff --git a/test/acceptance.d/session-test.sh b/test/acceptance.d/session-test.sh index 16c3171df26..e2720a03d39 100644 --- a/test/acceptance.d/session-test.sh +++ b/test/acceptance.d/session-test.sh @@ -30,16 +30,16 @@ wait_until "background layer is on screen" 30 layer_on_screen "omarchy-backgroun # Hiding parks the bar off-screen without unmapping its layer surface, and # revealing brings that same surface back on-screen. restore_bar_visibility() { - omarchy-toggle-bar off >/dev/null 2>&1 || true + omarchy-toggle-bar on >/dev/null 2>&1 || true } trap restore_bar_visibility EXIT -omarchy-toggle-bar on +omarchy-toggle-bar off wait_until "hidden bar layer stays mapped" 15 layer_present "omarchy-bar" wait_until "hidden bar layer parks off screen" 15 layer_off_screen "omarchy-bar" screenshot "success-bar-hidden" -omarchy-toggle-bar off +omarchy-toggle-bar on wait_until "revealed bar layer returns on screen" 15 layer_on_screen "omarchy-bar" screenshot "success-bar-revealed" trap - EXIT diff --git a/test/shell.d/toggle-test.sh b/test/shell.d/toggle-test.sh index 7ab3a54332c..693848b77f8 100644 --- a/test/shell.d/toggle-test.sh +++ b/test/shell.d/toggle-test.sh @@ -40,14 +40,29 @@ HOME="$test_home" omarchy-toggle example toggle [[ ! -f $flag ]] || fail "generic toggle flips enabled state off" pass "generic toggle flips enabled state off" +HOME="$test_home" omarchy-toggle-bar off +[[ -f $bar_flag ]] || fail "bar off sets the bar-off flag" +pass "bar off sets the bar-off flag" + +HOME="$test_home" omarchy-toggle-bar off +[[ -f $bar_flag ]] || fail "bar off is idempotent" +pass "bar off is idempotent" + HOME="$test_home" omarchy-toggle-bar on -[[ -f $bar_flag ]] || fail "bar on enables bar-off toggle" -pass "bar on enables bar-off toggle" +[[ ! -f $bar_flag ]] || fail "bar on lifts the bar-off flag" +pass "bar on lifts the bar-off flag" HOME="$test_home" omarchy-toggle-bar on -[[ -f $bar_flag ]] || fail "bar on is idempotent" +[[ ! -f $bar_flag ]] || fail "bar on is idempotent" pass "bar on is idempotent" -HOME="$test_home" omarchy-toggle-bar off -[[ ! -f $bar_flag ]] || fail "bar off disables bar-off toggle" -pass "bar off disables bar-off toggle" +HOME="$test_home" omarchy-toggle-bar +[[ -f $bar_flag ]] || fail "bar toggle hides a visible bar" +pass "bar toggle hides a visible bar" + +HOME="$test_home" omarchy-toggle-bar toggle +[[ ! -f $bar_flag ]] || fail "bar toggle reveals a hidden bar" +pass "bar toggle reveals a hidden bar" + +HOME="$test_home" omarchy-toggle-bar sideways 2>/dev/null && fail "bar rejects an unknown action" +pass "bar rejects an unknown action"