Two monitors, one game, and a workspace that wouldn't open where I was
The plan for this session was a small chore and then a real bug. The chore: kitty on my desktop had moved to 0.51.1, while workbench still pinned the 0.51.0 kitten binary it installs on servers. The bug: workspaces on my two monitors (the wide Samsung as DP-1, a portrait ASUS to its right as DP-2) had been misbehaving, and I’d written down three or four symptoms that morning while modding NieR Replicant, without being sure which ones were ours and which were Hyprland’s.
The chore went the way chores should. The agent downloaded both release binaries and their .sig files, checked the signatures against Kovid Goyal’s key (the one Arch’s kitty package pins, fetched from Arch’s own repo), replaced the two sums, and then ran bench’s real installer against the verified files in a scratch home directory. The first run installed 0.51.1 and the second said ok. The only snag was that the installer, sensibly, prefers a kitten already on the PATH, and my desktop has one in /usr/bin from the kitty package, so the test needed a PATH without it.
The workspaces took longer. The first symptom was that I couldn’t open a new workspace on one monitor if the other monitor was showing an empty one. Every “new workspace” path in workbench (Super+middle click, Super+number past the last workspace, the + on Waybar) used Hyprland’s emptynm, and reading Hyprland’s source showed what it actually does: it returns the next workspace ID that has no windows, on any monitor. The m only rules out IDs that workspace rules tie to another monitor. So if DP-2 was sitting on an empty workspace with the next ID, Super+middle click on DP-1 focused that one instead, over on DP-2. I’d enabled sudo so the agent could watch my session, and it started a recorder on Hyprland’s event socket (socat into gawk for timestamps, nothing fancier). When I tried it, the log showed exactly that, and it also explained something I’d mentioned in passing: the mouse jumped to DP-2, because Hyprland warps the cursor to the workspace it focuses.
The fix is a small Lua function that picks the lowest workspace ID nothing is using, which Hyprland then creates on the focused monitor. Waybar’s + button calls it too, which works because hyprctl dispatch evaluates Lua in the config’s own state, so a global function in hyprland.lua is reachable from a shell command. To pick up the new button I needed to restart Waybar, and the agent first told me bench bar, which would have started a second Waybar next to the first. The right one is bench bar --reload, which rewrites the config copy and signals the running bar. It corrected itself before I’d done any damage.
The more interesting one was the game. That morning, with NieR parked on DP-1’s second workspace and a terminal in view on the first, focusing Firefox on DP-2 had somehow moved the game onto the terminal’s workspace and pulled focus back to DP-1. Nothing in our config moves windows on its own. Hyprland does, though: when a client asks to go fullscreen on a particular output, Hyprland moves the window to whatever workspace that output is showing and focuses it. Wine asks for exactly that whenever its focus state changes. So the game lost focus, re-asserted fullscreen on DP-1, and Hyprland obligingly dragged it onto the workspace I was looking at. The same thing explains why dragging the game onto + that morning made it bounce between the monitors about forty times before it landed. Hyprland has a window rule for this, suppress_event = "fullscreenoutput", which keeps the fullscreen request and ignores the output part, so games (steam_app_*) get it now.
Then I tested it with the game. The class was steam_app_1113560, so the rule matched. With NieR parked on one workspace and the terminal in view, focusing Firefox on the other monitor did nothing to the game at all: not one window move in the log. Dragging it onto + made exactly one move, onto a new workspace on DP-1, and it still took input afterwards. The log also shows how hard the game leans on this. It toggled fullscreen 141 times in the same second while starting up (which, as far as I can tell, is just how it starts; it didn’t flicker any more than usual), and sent roughly 17,700 fullscreen events during the drag. Hyprland used to act on every one of them.
One symptom never showed up. I’d reported that moving the mouse to the portrait monitor switched the landscape one to workspace “1”, but in two recordings the mouse only ever changed which monitor had focus. One likely explanation is that Hyprland’s events name workspaces by their internal ID, and on DP-1 ID 1 is the workspace labeled 0, so a recorder line like focusedmon>>DP-1,1 reads like the wrong workspace when it isn’t. I don’t see it anymore either, so for now I’m calling it fixed, with a note in workbench’s testing doc on how to record it if it comes back.
What we ended up with:
kittenpinned to 0.51.1, signatures checked, installer tested.- New workspaces open on the monitor I’m on, from the keyboard, the mouse and the bar.
- Games stay on their workspace when focus moves or they’re dragged.
- A recipe for watching Hyprland’s events in
docs/TESTING.md, which will be the first thing I reach for next time.
The stale fullscreen flag that hid a terminal that morning hasn’t come back since the game stopped wandering around, which I suspect is not a coincidence.