Skip to content

XWayland windows don’t get focus/raise on launch under GNOME/Wayland despite activation tokens #62

@danjboyd

Description

@danjboyd

Environment

  • Distro: Debian 13 “trixie” (GNOME on Wayland, XWayland)
  • Backend: gnustep-back (x11/XWayland)
  • App: Gorm.app launched via openapp Gorm.app/
  • Desktop file: Gorm.desktop (matching app_id), StartupNotify=true
  • Activation: DESKTOP_STARTUP_ID and XDG_ACTIVATION_TOKEN populated (via portal ActivationToken.GetActivationToken, fallback to org.gnome.Shell.GetStartupId)
  • Focus policy: gsettings get org.gnome.desktop.wm.preferences focus-new-windows → smart

Symptom
Launching Gorm.app from GNOME (or via openapp in a console) opens the window behind existing windows. The window does not become focused/raised even though activation tokens are present. (same behavior on all gnustep apps)

Expected
A newly launched Gorm window should honor the activation token and come to the foreground (or at least not be forced behind other windows).

Actual
Window maps but stays behind other windows. GNOME/Mutter appears to ignore the activation token for the Gorm/XWayland surface. Manually activating/raising with wmctrl/xdotool windowactivate immediately brings it front.

Repro steps

  1. Set activation token (portal preferred):

    token=$(gdbus call --session
    --dest org.freedesktop.portal.Desktop
    --object-path /org/freedesktop/portal/desktop
    --method org.freedesktop.portal.ActivationToken.GetActivationToken
    "Gorm.desktop" "" "" | sed -n "s/.'(.)'.*/\1/p")
    export DESKTOP_STARTUP_ID="$token"
    export XDG_ACTIVATION_TOKEN="$token"

  2. Launch: openapp Gorm.app/

  3. Observe: window appears but remains behind terminal/other windows.

  4. Workaround: xdotool search --onlyvisible --name Gorm | head -n1 | xargs -r xdotool windowactivate --sync → window comes to front.

Observations

  • WM_CLASS (via xprop) is Gorm, GNUstep.
  • Tokens are visible in the process env (ps eww shows both).
  • Adding a post-launch raise loop in a wrapper script (polling for the window and calling xdotool windowactivate/windowraise) reliably fixes the problem; without it, focus is lost.
  • wmctrl -lx intermittently crashes on this system, but xdotool consistently finds and activates the window.

Request
Please investigate gnustep-back’s X11/XWayland focus/activation handling under GNOME/Wayland so that Gorm (and other GNUstep apps) honor DESKTOP_STARTUP_ID/XDG_ACTIVATION_TOKEN and are focused/raised on launch. If additional hints or code changes are required on the app side, please document them; otherwise,
consider setting the appropriate X11/XWayland hints in gnustep-back when mapping the first window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions