diff --git a/bin/omarchy-toggle-bar b/bin/omarchy-toggle-bar index be18a6472994..9d9c462c8134 100755 --- a/bin/omarchy-toggle-bar +++ b/bin/omarchy-toggle-bar @@ -4,7 +4,14 @@ # omarchy:args=[toggle|on|off] # omarchy:examples=omarchy toggle bar | omarchy toggle bar off | omarchy toggle bar on -omarchy-toggle bar-off "${1:-toggle}" +ACTION="${1:-toggle}" + +case $ACTION in + on) ACTION="off" ;; + off) ACTION="on" ;; +esac + +omarchy-toggle bar-off "$ACTION" # 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/bin/omarchy-toggle-fullscreen-desktop b/bin/omarchy-toggle-fullscreen-desktop index b5543f8510b6..0a7b60a9ad81 100755 --- a/bin/omarchy-toggle-fullscreen-desktop +++ b/bin/omarchy-toggle-fullscreen-desktop @@ -23,5 +23,9 @@ case $ACTION in ;; esac -omarchy-toggle-bar "$ACTION" +if [[ $ACTION == "on" ]]; then + omarchy-toggle-bar off +else + omarchy-toggle-bar on +fi omarchy-hyprland-toggle window-no-gaps "$ACTION" diff --git a/test/acceptance.d/session-test.sh b/test/acceptance.d/session-test.sh index 16c3171df261..e2720a03d399 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 0fdf76a2304d..4464c92a1ddc 100644 --- a/test/shell.d/toggle-test.sh +++ b/test/shell.d/toggle-test.sh @@ -41,16 +41,24 @@ HOME="$test_home" omarchy-toggle example toggle pass "generic toggle flips enabled state off" 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 disables bar-off toggle" +pass "bar on disables bar-off toggle" 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" +[[ -f $bar_flag ]] || fail "bar off enables bar-off toggle" +pass "bar off enables bar-off toggle" + +HOME="$test_home" omarchy-toggle-bar +[[ ! -f $bar_flag ]] || fail "bar toggle reveals a hidden bar" +pass "bar toggle reveals a hidden bar" + +HOME="$test_home" omarchy-toggle-bar toggle +[[ -f $bar_flag ]] || fail "explicit bar toggle hides a visible bar" +pass "explicit bar toggle hides a visible bar" # The gaps half of full screen copies a flag file in and reloads Hyprland, so # give it this checkout to copy from and a hyprctl that answers without a @@ -72,7 +80,7 @@ HOME="$test_home" omarchy-toggle-fullscreen-desktop [[ ! -f $bar_flag && ! -f $gaps_flag ]] || fail "fullscreen toggle restores the bar and the gaps together" pass "fullscreen toggle restores the bar and the gaps together" -HOME="$test_home" omarchy-toggle-bar on +HOME="$test_home" omarchy-toggle-bar off HOME="$test_home" omarchy-toggle-fullscreen-desktop [[ -f $bar_flag && -f $gaps_flag ]] || fail "fullscreen toggle pulls a half-hidden desktop into full screen" pass "fullscreen toggle pulls a half-hidden desktop into full screen"