From 679e14c37fda942cf0199c232e7c72888c3c6bcb Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Thu, 14 May 2026 18:04:25 -0400 Subject: [PATCH] Restore menu toggle behavior on keybinds and bar clicks The old bash bin short-circuited with close_visible_quickshell_menu at the top of open_quickshell_menu, so pressing any menu keybind while the menu was open just closed it. The IPC path I introduced summoned every time, so keyboard shortcuts couldn't dismiss \u2014 only outside clicks did (which is why the bar icon appeared to toggle: clicking it while the menu was open hit the menu's outer-click MouseArea, not the icon). Add a menu.toggle IPC method: - if root.opened: cancel() and return "closed" - otherwise: behaves exactly like summon Switch every Hyprland binding and the two bar-icon click handlers (omarchy logo, battery right-click \u2192 power menu) to toggle. summon stays as the always-open primitive for callers that want explicit summon semantics (rare \u2014 right now nothing internal uses it). --- default/hypr/bindings/utilities.lua | 24 +++++++++---------- .../omarchy-shell/plugins/bar/Bar.qml | 4 ++-- .../omarchy-shell/plugins/menu/Menu.qml | 13 +++++++++- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/default/hypr/bindings/utilities.lua b/default/hypr/bindings/utilities.lua index 19bafe59..6953e8c8 100644 --- a/default/hypr/bindings/utilities.lua +++ b/default/hypr/bindings/utilities.lua @@ -1,12 +1,12 @@ hl.bind("SUPER + SPACE", hl.dsp.exec_cmd("omarchy-launch-walker"), { description = "Launch apps" }) hl.bind("SUPER + CTRL + E", hl.dsp.exec_cmd("omarchy-launch-walker -m symbols"), { description = "Emoji picker" }) -hl.bind("SUPER + CTRL + C", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon capture"), { description = "Capture menu" }) -hl.bind("SUPER + CTRL + O", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon toggle"), { description = "Toggle menu" }) -hl.bind("SUPER + CTRL + H", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon hardware"), { description = "Hardware menu" }) -hl.bind("SUPER + ALT + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon root"), { description = "Omarchy menu" }) -hl.bind("SUPER + SHIFT + code:201", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon root"), { description = "Omarchy menu" }) -hl.bind("SUPER + ESCAPE", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon system"), { description = "System menu" }) -hl.bind("XF86PowerOff", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon system"), { locked = true, description = "Power menu" }) +hl.bind("SUPER + CTRL + C", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle capture"), { description = "Capture menu" }) +hl.bind("SUPER + CTRL + O", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle toggle"), { description = "Toggle menu" }) +hl.bind("SUPER + CTRL + H", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle hardware"), { description = "Hardware menu" }) +hl.bind("SUPER + ALT + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle root"), { description = "Omarchy menu" }) +hl.bind("SUPER + SHIFT + code:201", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle root"), { description = "Omarchy menu" }) +hl.bind("SUPER + ESCAPE", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle system"), { description = "System menu" }) +hl.bind("XF86PowerOff", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle system"), { locked = true, description = "Power menu" }) hl.bind("SUPER + K", hl.dsp.exec_cmd("omarchy-menu-keybindings"), { description = "Show key bindings" }) hl.bind("SUPER + ALT + K", hl.dsp.exec_cmd("omarchy-menu-tmux-keybindings"), { description = "Show Tmux key bindings" }) hl.bind("XF86Calculator", hl.dsp.exec_cmd("gnome-calculator"), { description = "Calculator" }) @@ -16,8 +16,8 @@ hl.bind("SUPER + SHIFT + CTRL + UP", hl.dsp.exec_cmd("omarchy-style-bar-position hl.bind("SUPER + SHIFT + CTRL + DOWN", hl.dsp.exec_cmd("omarchy-style-bar-position bottom"), { description = "Move bar to bottom" }) hl.bind("SUPER + SHIFT + CTRL + LEFT", hl.dsp.exec_cmd("omarchy-style-bar-position left"), { description = "Move bar to left" }) hl.bind("SUPER + SHIFT + CTRL + RIGHT", hl.dsp.exec_cmd("omarchy-style-bar-position right"), { description = "Move bar to right" }) -hl.bind("SUPER + CTRL + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon background"), { description = "Background switcher" }) -hl.bind("SUPER + SHIFT + CTRL + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon theme"), { description = "Theme menu" }) +hl.bind("SUPER + CTRL + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle background"), { description = "Background switcher" }) +hl.bind("SUPER + SHIFT + CTRL + SPACE", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle theme"), { description = "Theme menu" }) hl.bind("SUPER + BACKSPACE", hl.dsp.exec_cmd("omarchy-hyprland-window-transparency-toggle"), { description = "Toggle window transparency" }) hl.bind("SUPER + SHIFT + BACKSPACE", hl.dsp.exec_cmd("omarchy-hyprland-window-gaps-toggle"), { description = "Toggle window gaps" }) hl.bind("SUPER + CTRL + BACKSPACE", hl.dsp.exec_cmd("omarchy-hyprland-window-single-square-aspect-toggle"), { description = "Toggle single-window square aspect" }) @@ -36,15 +36,15 @@ hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("omarchy-hw-external-monitors && hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("omarchy-hyprland-monitor-internal on"), { locked = true }) hl.bind("PRINT", hl.dsp.exec_cmd("omarchy-capture-screenshot"), { description = "Screenshot" }) -hl.bind("ALT + PRINT", hl.dsp.exec_cmd("omarchy-capture-screenrecording --stop-recording || omarchy-shell-ipc menu summon trigger.capture.screenrecord"), { description = "Screenrecording" }) +hl.bind("ALT + PRINT", hl.dsp.exec_cmd("omarchy-capture-screenrecording --stop-recording || omarchy-shell-ipc menu toggle trigger.capture.screenrecord"), { description = "Screenrecording" }) hl.bind("SUPER + PRINT", hl.dsp.exec_cmd("pkill hyprpicker || hyprpicker -a"), { description = "Color picker" }) hl.bind("SUPER + CTRL + PRINT", hl.dsp.exec_cmd("omarchy-capture-text-extraction"), { description = "Extract text (OCR) from screenshot" }) -hl.bind("SUPER + CTRL + S", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon share"), { description = "Share" }) +hl.bind("SUPER + CTRL + S", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle share"), { description = "Share" }) hl.bind("SUPER + CTRL + PERIOD", hl.dsp.exec_cmd("omarchy-transcode"), { description = "Transcode" }) -hl.bind("SUPER + CTRL + R", hl.dsp.exec_cmd("omarchy-shell-ipc menu summon reminder-set"), { description = "Set reminder" }) +hl.bind("SUPER + CTRL + R", hl.dsp.exec_cmd("omarchy-shell-ipc menu toggle reminder-set"), { description = "Set reminder" }) hl.bind("SUPER + CTRL + ALT + R", hl.dsp.exec_cmd("omarchy-reminder show"), { description = "Show reminders" }) hl.bind("SUPER + SHIFT + CTRL + R", hl.dsp.exec_cmd("omarchy-reminder clear"), { description = "Clear reminders" }) diff --git a/default/quickshell/omarchy-shell/plugins/bar/Bar.qml b/default/quickshell/omarchy-shell/plugins/bar/Bar.qml index a919c410..45f00596 100644 --- a/default/quickshell/omarchy-shell/plugins/bar/Bar.qml +++ b/default/quickshell/omarchy-shell/plugins/bar/Bar.qml @@ -1388,7 +1388,7 @@ Item { tooltipText: "Omarchy Menu\n\nSuper + Alt + Space" onPressed: function(button) { if (button === Qt.RightButton) root.run("xdg-terminal-exec") - else root.run("omarchy-shell-ipc menu summon root") + else root.run("omarchy-shell-ipc menu toggle root") } } @@ -1944,7 +1944,7 @@ Item { tooltipText: root.batteryTooltip() onPressed: function(button) { if (button === Qt.RightButton) root.run("omarchy-notification-send \"$(omarchy-battery-status)\"") - else root.run("omarchy-shell-ipc menu summon power") + else root.run("omarchy-shell-ipc menu toggle power") } } } diff --git a/default/quickshell/omarchy-shell/plugins/menu/Menu.qml b/default/quickshell/omarchy-shell/plugins/menu/Menu.qml index 2e3c4ba8..2d374795 100644 --- a/default/quickshell/omarchy-shell/plugins/menu/Menu.qml +++ b/default/quickshell/omarchy-shell/plugins/menu/Menu.qml @@ -690,6 +690,17 @@ Item { return "ok" } + // Hitting the same menu keybind while the menu is already visible should + // close it — even if the requested target differs from the active one. + // Matches the old bash bin's `close_visible_quickshell_menu` short-circuit. + function toggle(initialMenu: string): string { + if (root.opened) { + root.cancel() + return "closed" + } + return summon(initialMenu) + } + function refresh(): string { defaultMenuFile.reload() userMenuFile.reload() @@ -697,7 +708,7 @@ Item { } function close(): string { - root.close() + root.cancel() return "ok" }