Press the browser key twice, get one browser

The application keys ran their command unconditionally, so pressing the
browser key twice gave you two browsers. That is the single most common
"Linux feels wrong" moment and it is a twenty-line fix: match the
window class, focus it if it is there, launch if it is not.

Two details the obvious version gets wrong. Patterns are anchored,
because an unanchored "mail" matches gmail-notifier and the mail key
would raise somebody's notifier. And class alone is not enough here:
the terminal and the editor are both kitty, so the editor bind narrows
by title or it raises whatever terminal happened to be open. The
contract's fixture contains both traps.

Found and fixed a bug this shipped with earlier today. Hyprland 0.56
dispatches through Lua, so `hyprctl dispatch focuswindow address:0x...`
is parsed as Lua source and fails with a syntax error -- which is what
the launcher's Switch Window command had been doing since it landed.
Its own contract stubbed hyprctl and recorded the arguments, so the
call looked correct and never ran. Both now use the selector form
hl.focus actually accepts, and the contract asserts the shape rather
than only that something was dispatched.
This commit is contained in:
Gabriel Brown
2026-08-22 06:02:47 -04:00
parent e1a04d2d70
commit 333ab9f6b7
7 changed files with 232 additions and 11 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ docs/ Settings reference, and the design specs behind the work
## Tests
144 of them, under `tests/`. Run the lot, or a subset by pattern:
145 of them, under `tests/`. Run the lot, or a subset by pattern:
```sh
panama test # everything