Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bin/omarchy-toggle-bar
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion bin/omarchy-toggle-fullscreen-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions test/acceptance.d/session-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions test/shell.d/toggle-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down