Skip to content

Improve xdg activation token integration - #9205

Open
jbms wants to merge 3 commits into
swaywm:masterfrom
jbms:activation-token-improvements
Open

Improve xdg activation token integration#9205
jbms wants to merge 3 commits into
swaywm:masterfrom
jbms:activation-token-improvements

Conversation

@jbms

@jbms jbms commented Jun 30, 2026

Copy link
Copy Markdown

The xdg activation token mechanism was designed primarily to prevent focus stealing, but also allows a "launch request" to be matched to the corresponding top-level window that is ultimately mapped as a result via the unique activation token. While not universally supported by all applications, it is now fairly widely supported.

This PR adds a number of related improvements to the existing support in sway for the activation token protocol:

  • Adds a mint_activation_token IPC command for creating a new activation token
  • Exposes initial_activation_token as a property in the JSON representation, to allow IPC clients to match a window with a corresponding launch request.
  • Adds initial_activation_token as a single-use, automatically cleaned up criteria.
  • Adds a for_exec_window command that runs an external program, like exec, and also specifies a list of sway commands to run on the window once it maps.

jbms added 3 commits June 30, 2026 14:32
Implement for_exec_window <commands> <exec command> to run the list of
commands on the next window created by the executed process.
The window is matched based on the process ID (PID) of the spawned process.
- Add initial_activation_token criteria to match windows by their XDG
  activation token (or X11 startup ID).
- Expose initial_activation_token in the window JSON representation (get_tree).
Implement IPC_MINT_ACTIVATION_TOKEN (102) to request the compositor to
mint a new XDG activation token. Add corresponding support to swaymsg
and document it in the man pages and completions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant