Skip to content

service/notifications: send an activation token with invoked actions - #1351

Open
dmkenney wants to merge 2 commits into
quickshell-mirror:masterfrom
dmkenney:notification-activation-token
Open

dmkenney wants to merge 2 commits into
quickshell-mirror:masterfrom
dmkenney:notification-activation-token

Conversation

@dmkenney

Copy link
Copy Markdown

Problem is when you click a notification, the app's window doesn't come forward.

After doing some testing and fixing, QuickShell detects the click, but it doesn't send the serial to the app - just doesn't pass it on. So Hyprland doesn't bring the window forward.

The fix is now QuickShell sends the app a token with the click's serial. And then the app shows that to Hyprland. And then the window comes forward.

@outfoxxed

Copy link
Copy Markdown
Member

Sorry, this is a duplicate of #1166. Please search first.

@outfoxxed outfoxxed closed this Oct 21, 2026
@outfoxxed outfoxxed reopened this Oct 21, 2026
@outfoxxed

Copy link
Copy Markdown
Member

*partial duplicate, rebase once 1166 is merged and use its token provisioning

@outfoxxed
outfoxxed force-pushed the master branch 2 times, most recently from bf6302e to 9b0f339 Compare October 22, 2026 06:48
@dmkenney
dmkenney force-pushed the notification-activation-token branch 2 times, most recently from bbc6bd4 to 250b480 Compare October 22, 2026 18:30
Comment thread src/wayland/activation.cpp Outdated
Comment on lines +74 to +82
QString requestActivationTokenNow() {
const auto token = std::make_shared<QString>();
if (!requestActivationToken([token](const QString& value) { *token = value; })) return {};

// The compositor answers the request with the done event, so a roundtrip delivers the token.
QtWaylandClient::QWaylandIntegration::instance()->display()->forceRoundTrip();
return *token;
}

@outfoxxed outfoxxed Oct 24, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blocks on the UI thread for an indeterminate amount of time, which is not allowed, and the compositor isn't even required to provide the token in that roundtrip.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

requestActivationToken() connected each callback to the input window's
xdgActivationTokenCreated signal, and the token object was owned by the
window. Two requests made before the compositor answered both got the
first token, and the second token was dropped. A request whose window
was destroyed before the answer, such as a launcher closing itself
after starting an app, lost its token and never ran its callback.

Give each request its own token object that runs its own callback, and
don't parent it to the window, so the token arrives either way.
Request a token with the shared activation helper and send it with the
ActivationToken signal before ActionInvoked, so the sender can raise
its window when it handles the action.

The token arrives asynchronously, and callers often dismiss the
notification right after invoking an action. Closes requested while an
invocation waits for its token are held until ActionInvoked has gone
out, so the client still sees ActionInvoked before NotificationClosed.
@dmkenney
dmkenney force-pushed the notification-activation-token branch from 858837d to cd1cba4 Compare November 24, 2026 17:39
maxstreese added a commit to maxstreese/maxnix that referenced this pull request Nov 28, 2026
Clicking a notification did nothing visible. An app may raise its
own window only with an activation token, which the notification
daemon is meant to hand over with the click. Quickshell 0.3.2 under
DMS does not: a click recorded on the session bus sent
ActionInvoked and NotificationClosed, and no ActivationToken. The
app then asks with a token niri does not accept.

niri's debug.honor-xdg-activation-with-invalid-serial has it honour
those requests. The price is focus-stealing protection: any app
that asks gets the focus, click or no click.

A workaround, so docs/blocked.toml tracks the upstream fix,
quickshell-mirror/quickshell#1351, open and waiting on a rebase.

The system builds and niri accepts the config. Not yet tried on the
running session: whether clicks now land on the right window.

Refs: quickshell-mirror/quickshell#1351
Co-Authored-By: Claude <noreply@anthropic.com>
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