From c70ae3a405f766bb78a4e4f0fb2fe534d96cfa1e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 21 Jul 2026 16:47:36 -0700 Subject: [PATCH] Group bar position under Style > Menu Bar and add transparency toggle omarchy bar transparent now accepts toggle, flipping the current value in one jq update (absent counts as opaque, matching the shell). Co-Authored-By: Claude Fable 5 --- bin/omarchy-bar | 15 ++++++++++----- default/omarchy/omarchy-menu.jsonc | 12 +++++++----- test/shell.d/config-test.sh | 4 ++++ test/shell.d/menu-test.sh | 13 +++++++++++++ 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/bin/omarchy-bar b/bin/omarchy-bar index 3ce9dd25..eb41c96b 100755 --- a/bin/omarchy-bar +++ b/bin/omarchy-bar @@ -2,7 +2,7 @@ # omarchy:summary=Set the active bar option, position, and transparency # omarchy:group=bar -# omarchy:args=use | reset | defaults | position | transparent +# omarchy:args=use | reset | defaults | position | transparent # omarchy:examples=omarchy bar use local.neon-bar | omarchy bar reset | omarchy bar defaults | omarchy bar position top | omarchy bar transparent true set -euo pipefail @@ -19,7 +19,7 @@ Usage: omarchy bar [args...] reset Return to the built-in Omarchy bar defaults Restore the default bar and service widgets position Bar position - transparent Bar transparency + transparent Bar transparency Bar widgets are added, moved, removed, and configured with 'omarchy bar plugin'. @@ -140,9 +140,14 @@ cmd_transparent() { local transparent="${1:-}" [[ -n $transparent ]] || fail "transparent is required" [[ $# -eq 1 ]] || fail "transparent takes a single value" - [[ $transparent =~ ^(true|false)$ ]] || fail "transparent must be true or false" - commit "$NORMALIZE | .bar.transparent = \$transparent" --argjson transparent "$transparent" - echo "Bar transparency set to $transparent" + [[ $transparent =~ ^(true|false|toggle)$ ]] || fail "transparent must be true, false, or toggle" + if [[ $transparent == "toggle" ]]; then + commit "$NORMALIZE | .bar.transparent = (.bar.transparent != true)" + echo "Bar transparency toggled" + else + commit "$NORMALIZE | .bar.transparent = \$transparent" --argjson transparent "$transparent" + echo "Bar transparency set to $transparent" + fi } # --------------------------------------------------------------------- dispatch diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index e995fdc5..f91e22f6 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -88,15 +88,17 @@ "style.theme": {"icon":"󰸌","label":"Theme","aliases":["theme","themes"],"keywords":"colors","action":"theme=$(omarchy-theme-switcher); [[ -n $theme ]] && omarchy-theme-set \"$theme\""}, "style.background": {"icon":"","label":"Background","aliases":["background","wallpaper"],"action":"background=$(omarchy-theme-bg-switcher); [[ -n $background ]] && omarchy-theme-bg-set \"$background\""}, "style.font": {"icon":"","label":"Font","keywords":"typeface","provider":"fonts"}, - "style.bar": {"icon":"󰍜","label":"Bar","keywords":"quickshell top bottom left right settings"}, + "style.bar": {"icon":"󰍜","label":"Menu Bar","keywords":"quickshell top bottom left right settings"}, + "style.bar.position": {"icon":"","label":"Position"}, + "style.bar.transparency": {"icon":"󰂵","label":"Transparency","action":"omarchy-bar transparent toggle"}, "style.hyprland": {"icon":"","label":"Hyprland","keywords":"look feel","action":"omarchy-launch-config-editor \"$HOME/.config/hypr/looknfeel.lua\""}, "style.screensaver": {"icon":"󱄄","label":"Screensaver","keywords":"branding"}, "style.about": {"icon":"","label":"About","keywords":"branding"}, "style.install": {"icon":"󰉉","label":"Install","keywords":"theme background font"}, - "style.bar.top": {"icon":"󰁝","label":"Top","keywords":"position","action":"omarchy-bar position top"}, - "style.bar.bottom": {"icon":"󰁅","label":"Bottom","keywords":"position","action":"omarchy-bar position bottom"}, - "style.bar.left": {"icon":"󰁍","label":"Left","keywords":"position","action":"omarchy-bar position left"}, - "style.bar.right": {"icon":"󰁔","label":"Right","keywords":"position","action":"omarchy-bar position right"}, + "style.bar.position.top": {"icon":"󰁝","label":"Top","action":"omarchy-bar position top"}, + "style.bar.position.bottom": {"icon":"󰁅","label":"Bottom","action":"omarchy-bar position bottom"}, + "style.bar.position.left": {"icon":"󰁍","label":"Left","action":"omarchy-bar position left"}, + "style.bar.position.right": {"icon":"󰁔","label":"Right","action":"omarchy-bar position right"}, "style.about.text": {"icon":"","label":"Edit Text","keywords":"branding","action":"omarchy-branding-about text"}, "style.about.image": {"icon":"","label":"Set From Image","keywords":"branding","action":"omarchy-branding-about image"}, "style.about.default": {"icon":"","label":"Restore Default","keywords":"branding","action":"omarchy-branding-about reset"}, diff --git a/test/shell.d/config-test.sh b/test/shell.d/config-test.sh index 1ec97c9f..6a036c1a 100755 --- a/test/shell.d/config-test.sh +++ b/test/shell.d/config-test.sh @@ -269,6 +269,10 @@ jq -e ' ' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null pass "shell config sets bar transparency" +HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar transparent toggle +jq -e '.bar.transparent == false' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null +pass "shell config toggles bar transparency" + HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar-plugin drop omarchy.active-window jq -e ' def ids: map(.id // .); diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index fcd0f838..f7434ccb 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -136,6 +136,19 @@ assert( !defaultById['trigger.toggle.direct-boot'] && !defaultById['trigger.toggle.passwordless-sudo'], 'menu removes the relocated toggles from Trigger > Toggle' ) +assert( + defaultById['style.bar.position'].kind === 'menu', + 'menu groups Menu Bar positions in a submenu' +) +assert( + ['top', 'bottom', 'left', 'right'].every(position => defaultById[`style.bar.position.${position}`].action === `omarchy-bar position ${position}`), + 'menu lists all Menu Bar positions under Position' +) +assertEqual( + defaultById['style.bar.transparency'].action, + 'omarchy-bar transparent toggle', + 'menu exposes Menu Bar transparency as a toggle' +) assertEqual( defaultById['trigger.hardware.laptop-display'].when, 'omarchy-hw-laptop',