Skip to content

Send an xdg-activation token with quickshell notification actions - #1367

Open
dmkenney wants to merge 3 commits into
omacom:masterfrom
dmkenney:quickshell-activation-token
Open

dmkenney wants to merge 3 commits into
omacom:masterfrom
dmkenney:quickshell-activation-token

Conversation

@dmkenney

@dmkenney dmkenney commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Part of omacom/omarchy#16078.

Clicking a notification sent from a browser service worker (Teams, Slack web, etc.) doesn't raise the window that sent it. Quickshell's notification server declares the ActivationToken signal but never emits it. Without a token the browser's client.focus() can't activate its window, so Hyprland ignores it.

xdg_activation_token.patch makes NotificationAction::invoke() request an xdg-activation token for the last user input and emit ActivationToken(id, token) before ActionInvoked, as the notification spec requires. The Wayland part lives in a new src/wayland/xdg_activation.cpp, installed from the Wayland plugin. The notifications module calls it through a small provider hook in src/core/activationtoken.hpp, so it has no Wayland code of its own. pkgrel goes to 2.

It's carried here, like load_qtquick_611.patch, and not sent upstream: quickshell does not accept contributions written with AI tools.

Testing

  • Builds with makepkg. Both patches apply with --fuzz=0 on 2b4501a.
  • tests/pinned-sources.sh and tests/package-metadata.sh pass.
  • Installed the package and clicked a real Teams notification in Brave from another workspace. dbus-monitor showed Notify, then ActivationToken, then ActionInvoked, and Brave switched to the Teams window that sent it.
  • Not tested: X11, aarch64.

This needs misc:focus_on_activate = true (Omarchy's default). omacom/omarchy#14283 would turn it off for browsers and block this again.

Update: Quickshell.activationToken()

The patch now also adds Quickshell.activationToken(), which returns a token for the most recent input from the same provider. omacom/omarchy#16097 uses it so the Apps launcher can raise an app that's already running once Hyprland checks token serials (#1379).

  • makepkg -f builds quickshell 0.3.2.r7.g2b4501a-2 with the updated patch. In the source tree, all 9 tests pass.
  • A panel built on this quickshell, run in nested Hyprland with the stricter check: a click called Quickshell.activationToken(), the launcher passed the token on, and the running Nautilus came forward.

Upstream: quickshell-mirror/quickshell#1351 (notification tokens) was closed as a duplicate of quickshell-mirror/quickshell#1166, which adds a shared activation helper for tray clicks. The notification part goes upstream on top of #1166 once it merges; quickshell-mirror/quickshell#1353 (Quickshell.activationToken()) waits for that. This patch is unaffected.

Update: patch rebuilt from the upstream PRs

The patch above is replaced. It waited for the token with a Wayland roundtrip on the UI thread, which quickshell review rejected. xdg_activation_token.patch is now these upstream commits as git format-patch output on the pinned 2b4501a:

The branch is rebased on master, so pkgrel is now 4 (master is at 3).

Testing:

  • Both patches apply with --fuzz=0 on 2b4501a. makepkg -Cf builds quickshell 0.3.2.r7.g2b4501a-4. tests/pinned-sources.sh and tests/package-metadata.sh pass.
  • Upstream tree with the same commits: all 9 unit tests pass. Two requests in one handler got two different tokens. A request followed by closing its window in the same handler still got a token.
  • Installed this package and ran the live Omarchy shell on it (Hyprland 0.56.2), with #16097 merged in:
    • A real pointer click on a toast from notify-send -A default=Open --wait: dbus-monitor showed ActivationToken, ActionInvoked, NotificationClosed, and notify-send printed default. A handler that took that token and called org.freedesktop.Application.Activate on Nautilus (on another workspace) brought Nautilus forward. A made-up token did not.
    • Apps launcher, typed and Enter: the launched app's environment had XDG_ACTIVATION_TOKEN, and launching Files with Nautilus open on another workspace brought its window forward.
  • Not tested: a real browser notification (Keep browsers from taking focus on activation requests omarchy#14283, merged into my test branch, stops browsers taking focus), tray clicks, X11, aarch64.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable defects were established.

Summary

Adds Wayland activation tokens to notification actions, tray clicks, and the new Quickshell.requestActivationToken() callback API.

  • Notification actions send activation tokens before they report the action.
  • System-tray clicks pass activation tokens to the selected app.
  • QML can request an activation token for the latest user input.

No new actionable issues were established.

Diagram

sequenceDiagram
    participant User
    participant Action as NotificationAction
    participant Wayland
    participant App as Notifying application
    User->>Action: Invoke action
    Action->>Wayland: Request activation token
    Note over Action: Hold requested close
    Wayland-->>Action: Token
    Action-->>App: ActivationToken
    Action-->>App: ActionInvoked
    Action-->>App: NotificationClosed, if requested
Loading

Reviews (3) · Last reviewed commit: "Rebuild quickshell's activation token pa..." · Reviewed by Greptile

@dmkenney
dmkenney force-pushed the quickshell-activation-token branch from ef55897 to 91f2534 Compare October 24, 2026 14:36
Clicking a notification sent from a browser service worker, such as
Teams in Brave, closed it but did not raise the window that sent it.
Quickshell declares the ActivationToken signal but never emits it, so
the browser has no token and Hyprland ignores its focus request.

The patch requests a token for the last user input when an action is
invoked and emits ActivationToken before ActionInvoked, as the
notification spec requires.
Add Quickshell.activationToken(), which returns a token for the most
recent input from the same provider the notification actions use. The
Omarchy launcher passes it to the app it launches, so an app that is
already running can raise its window on a Hyprland that checks token
serials.
The old patch waited for the token with a Wayland roundtrip on the UI
thread, which can block for as long as the compositor takes, and a
roundtrip doesn't guarantee the token has arrived. Upstream review
rejected that approach.

The patch is now the upstream commits on top of the pinned commit:
quickshell-mirror/quickshell#1166 (merged: shared activation helper and
tray tokens), and omacom#1351 and omacom#1353 (notification tokens and
Quickshell.requestActivationToken(), both async). omacom#1351 also gives each
token request its own callback, so overlapping requests get their own
tokens and a request survives its window closing.
Quickshell.activationToken() is gone; omacom/omarchy#16097 moves to the
callback.
@dmkenney
dmkenney force-pushed the quickshell-activation-token branch from 91f2534 to 65c837c Compare November 24, 2026 17:38
@dmkenney

Copy link
Copy Markdown
Contributor Author

Rebased on master, where quickshell is at pkgrel 11, so this is now 12. The patch is unchanged and still applies to 2b4501a (makepkg -o).

This branch has not been deployed

No deployments
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.

1 participant