From 48bfdb1a37decd3b752b1bfa37b9f1e8db2bc667 Mon Sep 17 00:00:00 2001 From: Ciro Rivera Date: Mon, 16 Nov 2026 02:25:20 -0600 Subject: [PATCH] Keybinds: the close bind closes a sheet, not the window behind it A Lucid sheet that holds the keyboard (the keybinds sheet, What's new, the session menu, the switcher, polkit) sits over the focused window, but Hyprland's binds still reach that window: SUPER+C over the keybinds sheet left the sheet up and closed the window under it. The close bind now looks for a layer with exclusive keyboard focus first, closes the sheet it knows, and never the window while one is up. It lives in binds.lua so existing keybinds.json files get it too. Fixes #113 --- support/hypr/modules/binds.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/support/hypr/modules/binds.lua b/support/hypr/modules/binds.lua index 7c0e3d1..acf6521 100644 --- a/support/hypr/modules/binds.lua +++ b/support/hypr/modules/binds.lua @@ -69,6 +69,25 @@ local function fill(s, n, key) return (string.gsub(string.gsub(s, "{n}", tostring(n)), "{key}", tostring(key))) end +-- a Lucid sheet holding the keyboard (exclusive layer) sits over the focused +-- window, so the close bind meant the sheet: close it, never the window behind +local SHEETS = { + lucidkeybinds = "keybinds", lucidwhatsnew = "whatsnew", ["lucid-session"] = "session", + ["lucid-switcher"] = "switcher", lucidpolkit = "polkit", +} +local function close_over_sheet(close) + return function() + for _, l in ipairs(hl.get_layers()) do + if l.mapped and l.keyboard_interactivity == 1 then + local target = SHEETS[l.namespace] + if target then hl.dispatch(hl.dsp.exec_cmd("qs ipc call " .. target .. " close")) end + return + end + end + if type(close) == "function" then close() else hl.dispatch(close) end + end +end + local function bind_one(entry, n, key) local keys = fill(entry.keys, n, key) if type(keys) ~= "string" or keys == "" then error("no keys", 0) end @@ -82,6 +101,7 @@ local function bind_one(entry, n, key) action = hl.dsp.exec_cmd(cmd) end + if entry.id == "close" then action = close_over_sheet(action) end local opts = {} if type(entry.opts) == "table" then for k, v in pairs(entry.opts) do opts[k] = v end