mirror of
https://github.com/storytold/egui.git
synced 2026-11-24 03:22:06 +01:00
- related #8282 - part of https://github.com/emilk/egui/issues/8142 A desktop entry with `StartupNotify=true` hands the launched process an activation token through `XDG_ACTIVATION_TOKEN` (Wayland) or `DESKTOP_STARTUP_ID` (X11). winit can apply one, but only at window creation, via `WindowAttributesExtStartupNotify::with_activation_token`. eframe never reads it, so the token our launcher went to the trouble of issuing is thrown away. winit's own docs are blunt about the consequence: > The `ActivationToken` is essential to ensure that your newly created window will obtain the focus, otherwise the user could be required to click on the window. That is what I ran into: under Mutter the window opens unfocused and cannot recover, since `ViewportCommand::Focus` is precisely the request focus-stealing prevention blocks. On a kiosk-style setup the cost goes past a missing title-bar highlight — a compositor only grants a pointer constraint to a focused surface, so `CursorGrab` silently does nothing too. This reads the variable when building the window attributes and passes it to winit. The environment is cleared afterwards through winit's `reset_activation_token_env()`, per the startup-notification spec: a token is single-use, and leaving it around would have every later viewport, and every child process, replay it. Linux only, behind the existing `wayland`/`x11` features; a no-op when the variables are absent. Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>