Improve xdg activation token integration - #9205
Open
jbms wants to merge 3 commits into
Open
Conversation
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.
jbms
force-pushed
the
activation-token-improvements
branch
from
June 30, 2026 23:41
aca69c0 to
3293d91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
mint_activation_tokenIPC command for creating a new activation tokeninitial_activation_tokenas a property in the JSON representation, to allow IPC clients to match a window with a corresponding launch request.initial_activation_tokenas a single-use, automatically cleaned up criteria.for_exec_windowcommand that runs an external program, likeexec, and also specifies a list of sway commands to run on the window once it maps.