Open shell menus and panels through Hyprland global shortcuts (#13418)

Every binding that opened a menu or panel ran omarchy-menu or
omarchy-shell, which starts a qs client just to deliver one IPC call:
~60ms before the shell heard about the keypress.

The shell now registers a Hyprland global shortcut for each menu route
and panel in default/omarchy/shortcuts, and o.bind turns { menu = ... }
and { panel = ... } into hl.dsp.global for those, so a keypress spawns
nothing. A route or panel missing from the list binds through the
command as before. The default menu and panel bindings use the new form.

SUPER+SPACE opens the menu in ~31ms instead of ~94ms, measured from a
simulated keypress until the menu layer maps.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 authored and GitHub committed 2026-09-27 18:02:01 +02:00
1 parent fd961e5300
commit 6762769bbf
9 files changed
+251 -22

No files matched your search

+38
View File
@@ -1,5 +1,7 @@
-- Shared helpers for Hyprland Lua configuration.
local paths = require("default.hypr.paths")
o = o or {}
local function shell_quote(value)
@@ -53,6 +55,38 @@ function o.cmd_missing(command)
return not o.cmd_present(command)
end
-- The global shortcuts the shell registers, read from the same list it reads.
local shell_shortcuts = nil
local function shell_shortcut_registered(name)
if not shell_shortcuts then
shell_shortcuts = {}
local file = io.open(paths.omarchy_path .. "/default/omarchy/shortcuts", "r")
if file then
for line in file:lines() do
local kind, target = line:match("^(%a+)%s+(%S+)%s*$")
if kind then
shell_shortcuts[kind .. "." .. target] = true
end
end
file:close()
end
end
return shell_shortcuts[name] == true
end
-- Reach the shell through its global shortcut when it registers one, so the
-- keypress spawns nothing. Anything else runs the command as before.
local function shell_dispatcher(kind, target, command)
local name = kind .. "." .. target
if shell_shortcut_registered(name) then
return hl.dsp.global("omarchy:" .. name)
end
return command
end
local function command_from(value, description)
if type(value) ~= "table" then
return value
@@ -60,6 +94,10 @@ local function command_from(value, description)
if value.omarchy then
return "omarchy-launch-" .. value.omarchy
elseif value.menu then
return shell_dispatcher("menu", value.menu, "omarchy-menu toggle " .. shell_quote(value.menu))
elseif value.panel then
return shell_dispatcher("panel", value.panel, "omarchy-shell shell toggle " .. shell_quote(value.panel))
elseif value.focus and value.launch then
return o.launch_sole(value.focus, value.launch)
elseif value.launch then