Repository navigation
kawa: support xdg-activation-v1 - #18
Merged
Merged
Conversation
Create the xdg_activation_v1 global and grant focus only for a token that wlroots tied to a real input serial and whose surface had the keyboard when the token was made or still has it. Tokens without a surface are refused. A refused request marks the window as wanting attention instead of moving focus. Requests can arrive before the window maps, so an allowed one is remembered and applied on map.
Draw a window that was refused activation with the selection color border, even if it draws its own decorations, and draw its hidden menu entry in that color. Both clear when the window gets focus.
Export XDG_ACTIVATION_TOKEN and DESKTOP_STARTUP_ID from a token that kawa creates and trusts, so that a program that supports either can take focus when it opens its window.
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.
Why
A window launched from a terminal never gets focus today, and only windows opened through New are focused when they map. Rather than focus every new window, which would let any client steal focus, this adds xdg-activation-v1: a window gets focus only when it presents a token tied to recent input on the surface the user was using. It uses the bindings from DeedleFake/wlr#13, which is merged, and the last commit bumps wlr to master at fb0cc1b.
Scope
xdg_activation_v1global. A request is granted only if wlroots tied the token to a real input serial (the token has a seat) and the token's surface had the keyboard when the token was made, or still has it. A token with no surface is refused, as in sway, because a bare serial can't be tied to what the user was doing. A granted request focuses and raises the window, or unhides it if it is hidden.XDG_ACTIVATION_TOKENandDESKTOP_STARTUP_IDfrom a token kawa creates and trusts.Tradeoffs
The policy is stricter than labwc, which only checks for a seat. It also requires keyboard focus, where wlroots accepts pointer focus too. So a click-made token from a window under the pointer but without the keyboard only gets attention. Tokens that wlroots rejects at commit time, such as one with serial 0 that GTK sends for self-activation, never reach kawa, so they can't mark attention either. weston-terminal and foot's spawn-terminal don't pass tokens on, so programs started from them still don't get focus, which is the intended behavior.
Blast Radius
Only windows that ask for activation are affected. Existing focus, New, menus and layer shell behave as before.
Verification
go build ./...andgo vet ./...pass on every commit. On a nested Xvfb session I checked these cases:The core verify-kawa flow and a layer-shell smoke run with swaybg, waybar and fuzzel still pass.