Dragging windows onto the bar
Hyprland has been working really well on desktom, but moving between workspaces still felt a bit clumsy. I had Super+number and the mouse’s side buttons, and that was about it. So I asked for two things: a couple of extra bindings (Super+middle click for a new workspace, and Super+PgUp and Super+PgDn to step back and forward from the keyboard), and the ability to drag a window onto a workspace number in Waybar to send it there, or onto the “+” button to send it to a new one.
The bindings were the easy half. Hyprland already understands “previous/next workspace on this monitor” (the side buttons use it), so Super+PgUp and Super+PgDn just point at the same thing, and Super+middle click opens the next empty workspace, same as clicking “+”. The agent also added Super+Shift+PgUp/PgDn to take the window along, which I hadn’t asked for but would have, sooner or later.
The dragging was more interesting, because neither half of it was really built for this. Waybar is a separate program sitting in a layer on top of the screen, and while you drag a window Hyprland holds on to the pointer, so Waybar never sees the window arrive. Even if it did, it has no way of telling anyone where its buttons are. The way around it was to let Hyprland do all of it. Hyprland 0.57 has a “drag” kind of bind that fires when you let go of a button after moving the mouse, so there’s now a second bind on Super+left click that runs at the end of every window drag. It checks whether the cursor is over that monitor’s bar and, if so, works out which button it’s over from how far it is from the bar’s left edge. That only works if the buttons are a known width, so the bar’s stylesheet now pins the workspace buttons and “+” at 24 pixels each (which, as it happens, is what the old padding added up to, so nothing looks different). A floating window gets centered on arrival, since otherwise it would land right where you dropped it, half under the bar.
Testing it was the other surprise. The agent normally tries desktop changes in a throwaway compositor so it doesn’t touch my session, but a nested Hyprland wouldn’t start on the headless test display (it wants a GPU, and the test display doesn’t have one). So it shipped with nothing more than Hyprland’s config check and the unit tests behind it, plus a list of the three things most likely to be wrong: the drop bind not firing next to the drag bind, Waybar ordering the buttons differently, or my GTK theme sneaking in a margin.
None of them happened. I pulled it into my own clone, reloaded, and it worked perfectly the first time, which is not what I’ve come to expect from anything involving pixel offsets.