Repository navigation
service/tray: forward Wayland activation tokens on primary clicks - #1166
domenkozar wants to merge 1 commit into
Conversation
|
Do you have a reason to avoid QWaylandWindow::requestXdgActivationToken? |
|
I used the protocol directly because Qt’s method needs support from Quickshell’s layer-shell implementation, which currently just emits an empty token. We could add that support and then use QWaylandWindow::requestXdgActivationToken() in the tray code. |
Please do |
8cdc568 to
c98e2fb
Compare
|
CI failed unrelatedly |
There was a problem hiding this comment.
Why not use QWaylandXdgShell::activation()?
There was a problem hiding this comment.
Qt doesn’t install the client headers needed for QWaylandXdgShell::activation(), which xdgshell.hpp already notes. I’ve consolidated activation support into a shared Wayland helper used by the tray and layer-shell. Is that approach acceptable, or is there an access path to Qt’s activation helper I’ve missed?
| /// Primary activation action, generally triggered via a left click. | ||
| /// On Wayland, forwards an activation token from the most recent input event | ||
| /// when supported. Call directly from the input handler to preserve its context. | ||
| Q_INVOKABLE void activate(); |
There was a problem hiding this comment.
Now duplicates LayerSurface::requestXdgActivationToken
72a1ce2 to
11ca60b
Compare
f457ca9 to
0409ad6
Compare
0409ad6 to
657e3fa
Compare
Tray clicks currently send only
Activate(0, 0). A native Wayland application cannot use the panel's input event to request focus, so compositors such as niri may leave its existing window unfocused.Request a token through
QWaylandWindow::requestXdgActivationToken()using Qt's last input serial and window, then deliver it withProvideXdgActivationTokenbefore callingActivate. Implement the corresponding layer-shell override so this works for panels as well as ordinary Qt windows. The activation protocol implementation belongs to layer-shell, and the tray service uses Qt's window API.The existing
SystemTrayItem.activate()QML API is unchanged. Missing input context, unavailable activation support, a one-second timeout, and applications that reject the optional token method all preserve ordinary activation. Ignore callbacks after the tray item disappears. Allow only one pending tray token request per window, so a late response cannot be reused for another tray click; overlapping clicks use ordinary activation.Validation:
QT_QPA_PLATFORM=wayland. The popup-positioning test fails with Qt's offscreen/minimal backends.Activate; the legacy item rejects the unsupported token method and still activates.Prepared with AI assistance for human review.