fix(wayland): recover the startup activation token GTK unsets - #407
Merged
Merged
Conversation
GTK 4.16 and later save XDG_ACTIVATION_TOKEN and DESKTOP_STARTUP_ID for their own windows and unset both as soon as libgtk-4 loads, before main. With the default toolbar-gtk feature, the overlay's std::env read of the token always came back empty, so the xdg fallback window (GNOME and other compositors without layer-shell) never applied the token a launcher or the portal global shortcut passed, and could open without focus. - Read startup-notification variables from the launch environment, /proc/self/environ, falling back to the live environment without /proc. - Use XDG_ACTIVATION_TOKEN, else DESKTOP_STARTUP_ID, keeping the trimming and empty-value handling. - Forward both variables when `--active` relaunches itself detached: the broker relaunches with the live environment, which no longer has them. - Reuse the reader in the fake overlay fixture.
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.
GTK 4.16 and later remove
XDG_ACTIVATION_TOKENandDESKTOP_STARTUP_IDwhen libgtk-4 loads, beforemain. In default builds, the overlay therefore lost the token supplied by a desktop launcher or the GlobalShortcuts portal, preventing the xdg fallback window from applying it and potentially leaving the overlay unfocused.Recover startup-notification values from
/proc/self/environ, with a live-environment fallback when/proccannot be read. PreferXDG_ACTIVATION_TOKEN, thenDESKTOP_STARTUP_ID, with trimming and empty-value handling. Forward both values through the detached--activerelaunch, and share the reader with the fake overlay fixture.Validation:
tools/lint-and-test.shpassed: 26 steps and 11,558 Cargo tests across both feature modes.Real GNOME focus behavior remains unvalidated. A manual check of overlay focus after the portal shortcut is still needed.