Skip to content

Report titlebar drags on socket2 - #14

Closed
n0rthstar88 wants to merge 2 commits into
omacom:mainfrom
n0rthstar88:report-titlebar-drags
Closed

n0rthstar88 wants to merge 2 commits into
omacom:mainfrom
n0rthstar88:report-titlebar-drags

Conversation

@n0rthstar88

@n0rthstar88 n0rthstar88 commented Nov 6, 2026 •

Copy link
Copy Markdown

A titlebar drag holds the pointer button, so the press and release never reach Hyprland's binds, and nothing outside the plugin can tell a window is being moved by its titlebar. That leaves tools that act on a dropped window, like snapping it into a layout when it's dragged to the top edge, working for Super-drags and app-drawn titlebars but not for these titlebars.

This posts two custom socket2 events:

custom>>hyprbars:dragstart
custom>>hyprbars:dragend

dragstart comes when a move actually begins (pointer or touch), and dragend when it ends. They're paired: a flag makes sure every dragstart gets exactly one dragend, and nothing else sends one. That holds when the window is closed mid-drag or another window takes focus before the release. Clicks, double-clicks, button presses and a resize from the edge above the titlebar send nothing. The names match what the event dispatcher produces (hl.dsp.event), so a listener handles both the same way. The README has a short section on them.

Testing

tools/verify.py now listens on the nested compositor's socket2 and checks that:

  • a top-edge resize sends no drag events
  • each of the two titlebar drags sends exactly one dragstart and one dragend
  • closing a window while its titlebar is held still sends dragend
  • moving focus to another window mid-drag still sends dragend, and the next drag sends a fresh dragstart
  • a double-click maximize sends nothing

It waits for the expected events with a timeout rather than a fixed sleep, and fails if the socket reader stops.

I'm on Hyprland 0.56.2, so I ran the verifier on the same change applied to v0.2.2, with 0.56's g_pEventManager->postEvent in place of IPC::Socket2::sock()->postEvent. Every check passes, on three runs. Against the stock 0.2.2 package the drag check fails with no events, and against this PR's first commit the closed-window and focus-change checks each fail with a lone dragstart, as expected. On main I compile-checked the 0.57 call against Hyprland v0.57.0's src/ipc/s2/S2.hpp (it's written the same way as Group.cpp's togglegroup event), but I haven't built or run the whole plugin against 0.57.

A titlebar drag holds the pointer button, so the press and release never
reach Hyprland's binds, and nothing outside the plugin can tell that a window
is being moved by its titlebar. Post custom>>hyprbars:dragstart when a move
begins and custom>>hyprbars:dragend when it ends, so tools listening on
socket2 can act on where a window was dropped, such as snapping it into a
layout at a screen edge.

Clicks, button presses and top-edge resizes send nothing. The verifier now
listens on the nested compositor's socket2 and checks all of these.
@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; all previous findings are addressed.

Summary

The PR reports titlebar moves through custom socket2 events.

  • Titlebar moves now send paired start and end events to socket2 listeners.
  • Git now ignores Python cache folders.

All three previous findings are addressed. No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Titlebar move begins] --> B[Send dragstart and set flag]
  B --> C{Move ends}
  C --> D[Pointer or touch released]
  C --> E[Decoration destroyed]
  D --> F{Flag set?}
  E --> F
  F -->|Yes| G[Clear flag and send dragend]
  F -->|No| H[Send nothing]
Loading

Reviews (2) · Last reviewed commit: "End reported drags when the window close..." · Reviewed by Greptile

Comment thread barDeco.cpp Resolved
Comment thread barDeco.cpp Resolved
Comment thread tools/verify.py Resolved
A titlebar drag could send dragstart without a dragend. Closing the window
mid-drag destroyed its bar without ending the move, and a release after
another window took focus returned before the move was ended, which also left
the next drag on that bar without a dragstart. End the reported move in both
cases, and skip posting while Hyprland shuts down and has no socket.

The verifier now waits for the expected events instead of sleeping, reports
socket reader failures, and checks both cases. Drop the compiled verifier
that was committed by mistake and ignore __pycache__.
@dhh

dhh commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Thanks! Closing in favor of #15, which reports every kind of window move drag (titlebar, Super-drag, app headerbars) through 0.57's drag controller. That will land together with window snapping (omacom/omarchy#18141).

@dhh dhh closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants