Open a new one with SUPER, go to the old one with SUPER+ALT
Making the plain application keys focus an existing window was the wrong call. It reads well in a demo and it is what macOS does, but it made "give me another terminal" the awkward case -- and on a tiling desktop a second terminal beside the first is the normal way to work, not an edge case. Reaching for the launcher to open a second file manager is not an improvement on anything. So the plain keys do what they always did, and SUPER+ALT is the new capability rather than a tax on the old one: go to the terminal, editor, browser, files, calculator or mail you already have, wherever it is, and start one only if there is none. ALT rather than SHIFT because SUPER+SHIFT is already the window-manipulation space -- Files, Neovim and Settings would have collided with Focus session, Taller and Shorter, and breaking two keys out of the eight-key resize set to make room is the worse trade. Also fixes a real trap found while using it. The Alt-Tab overlay commits on SUPER release, which is a compositor bind running an IPC call; if that call ever fails to land, the overlay stayed up with no keyboard focus, no Escape handler and nothing clickable, so the only way out was an IPC call typed into a terminal it was covering. Clicking outside now dismisses it, clicking a row switches to that window -- which is the obvious thing to try and did nothing -- and an abandoned switch closes itself after ten seconds. Keyboard focus still stays with the compositor, because taking it mid-switch is what would break stepping.
This commit is contained in:
@@ -285,6 +285,7 @@ The mental model is unchanged from Forge:
|
||||
| `SUPER + SHIFT + P` | Color picker |
|
||||
| `CTRL + ALT + L` · `SUPER + Backspace` | Lock (SUPER+L is "focus right") |
|
||||
| `SUPER + /` | Every shortcut, on screen. Reads the live keymap, so a rebind shows here |
|
||||
| `SUPER + ALT + T/N/W/F/C/E` | Go to that application if it is open, rather than starting another |
|
||||
| `CTRL + ALT + Delete` | Power menu |
|
||||
|
||||
### Apps
|
||||
|
||||
@@ -136,23 +136,35 @@ local function write_categories()
|
||||
file:close()
|
||||
end
|
||||
|
||||
-- Focus it if it is already open, start it if it is not -- which is what the
|
||||
-- application keys do on macOS and Windows, and what pressing the browser key
|
||||
-- twice ought to do. bin/panama-launch matches on window class, narrowed by
|
||||
-- title where the class alone cannot tell two things apart: the terminal and
|
||||
-- the editor are both kitty here, so only the title distinguishes them.
|
||||
-- SUPER opens a new one. SUPER+ALT goes to the one you already have.
|
||||
--
|
||||
-- That order matters and was chosen deliberately after trying the reverse.
|
||||
-- Making the plain key focus an existing window reads well in a demo and is
|
||||
-- what macOS does, but it makes "give me another terminal" the awkward case --
|
||||
-- and on a tiling desktop, opening a second terminal beside the first is not
|
||||
-- an edge case, it is the normal way to work. So the plain key keeps doing
|
||||
-- what it has always done, and the modifier is the new capability rather than
|
||||
-- a tax on the old one.
|
||||
--
|
||||
-- ALT rather than SHIFT because SUPER+SHIFT is already the window-manipulation
|
||||
-- space: Files, Neovim and Settings would have collided with Focus session,
|
||||
-- Taller and Shorter, and breaking two keys out of the eight-key resize set to
|
||||
-- make room is a worse trade than borrowing a modifier.
|
||||
--
|
||||
-- The go-to binds still launch when nothing is open. A key that silently does
|
||||
-- nothing is worse than one that does the obvious thing.
|
||||
--
|
||||
-- Patterns are regular expressions and are anchored. An unanchored "mail"
|
||||
-- would match gmail-notifier, and the mail key would raise somebody's notifier
|
||||
-- instead. Single-quoted for the shell so a backslash reaches the matcher
|
||||
-- rather than being eaten on the way.
|
||||
-- would match gmail-notifier, and the go-to-mail key would raise somebody's
|
||||
-- notifier instead. Single-quoted for the shell so a backslash reaches the
|
||||
-- matcher rather than being eaten on the way.
|
||||
local function shell_quote(value)
|
||||
return "'" .. value:gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
|
||||
local launcher_bin = "$HOME/.local/share/Panama/bin/panama-launch"
|
||||
|
||||
local function launch_or_focus(class, command, title)
|
||||
local function go_to(class, command, title)
|
||||
local parts = { launcher_bin, "--class", shell_quote(class) }
|
||||
if title then
|
||||
parts[#parts + 1] = "--title"
|
||||
@@ -164,12 +176,26 @@ local function launch_or_focus(class, command, title)
|
||||
end
|
||||
|
||||
category("Applications")
|
||||
bind(mod .. " + T", hl.dsp.exec_cmd(launch_or_focus("^kitty$", terminal)), { description = "Terminal" })
|
||||
bind(mod .. " + N", hl.dsp.exec_cmd(launch_or_focus("^kitty$", editor, "nvim")), { description = "Neovim" })
|
||||
bind(mod .. " + W", hl.dsp.exec_cmd(launch_or_focus("^helium", browser)), { description = "Browser" })
|
||||
bind(mod .. " + F", hl.dsp.exec_cmd(launch_or_focus("^org\\.gnome\\.Nautilus$", files)), { description = "Files" })
|
||||
bind(mod .. " + C", hl.dsp.exec_cmd(launch_or_focus("^org\\.gnome\\.Calculator$", calculator)), { description = "Calculator" })
|
||||
bind(mod .. " + E", hl.dsp.exec_cmd(launch_or_focus("^org\\.mozilla\\.thunderbird", mail)), { description = "Mail" })
|
||||
bind(mod .. " + T", hl.dsp.exec_cmd(terminal), { description = "Terminal" })
|
||||
bind(mod .. " + N", hl.dsp.exec_cmd(editor), { description = "Neovim" })
|
||||
bind(mod .. " + W", hl.dsp.exec_cmd(browser), { description = "Browser" })
|
||||
bind(mod .. " + F", hl.dsp.exec_cmd(files), { description = "Files" })
|
||||
bind(mod .. " + C", hl.dsp.exec_cmd(calculator), { description = "Calculator" })
|
||||
bind(mod .. " + E", hl.dsp.exec_cmd(mail), { description = "Mail" })
|
||||
|
||||
-- Go to the one already open, or start it if there is none.
|
||||
bind(mod .. " + ALT + T", hl.dsp.exec_cmd(go_to("^kitty$", terminal)),
|
||||
{ description = "Go to terminal" })
|
||||
bind(mod .. " + ALT + N", hl.dsp.exec_cmd(go_to("^kitty$", editor, "nvim")),
|
||||
{ description = "Go to Neovim" })
|
||||
bind(mod .. " + ALT + W", hl.dsp.exec_cmd(go_to("^helium", browser)),
|
||||
{ description = "Go to browser" })
|
||||
bind(mod .. " + ALT + F", hl.dsp.exec_cmd(go_to("^org\\.gnome\\.Nautilus$", files)),
|
||||
{ description = "Go to files" })
|
||||
bind(mod .. " + ALT + C", hl.dsp.exec_cmd(go_to("^org\\.gnome\\.Calculator$", calculator)),
|
||||
{ description = "Go to calculator" })
|
||||
bind(mod .. " + ALT + E", hl.dsp.exec_cmd(go_to("^org\\.mozilla\\.thunderbird", mail)),
|
||||
{ description = "Go to mail" })
|
||||
bind(mod .. " + I", hl.dsp.exec_cmd(settings), { description = "Settings" })
|
||||
bind("CTRL + SHIFT + Escape", hl.dsp.exec_cmd(sysmonitor), { description = "System monitor" })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user