Expand description
Shared helpers for showing the long-lived main window (the
Preferences UI), with a Linux/Wayland-specific workaround for #139.
The main window is created visible: false (tauri.conf.json) and
shown on demand from the tray. On GNOME/Wayland a window shown after
being created hidden never receives an initial configure event from
the compositor until the user manually resizes it, so its client-side
decoration input region stays stale and the close/minimise controls
swallow clicks until the first double-click-to-maximise toggle
(upstream tauri-apps/tauri#13440, still open).
The 0.0.6 fix nudged the size +1px and back synchronously after
show(). That never cleared it on Steffi’s Ubuntu 24.04 / GNOME /
Wayland setup: Wayland batches surface state until commit, so two
set_size calls in the same event-loop turn coalesce to the final
(unchanged) size and no configure is emitted — the synchronous nudge
was a no-op there. Given a hidden window shown later needs a committed
state change, the strategies here defer their second half onto a later
event-loop tick, and maximize is the default because Steffi confirmed
it clears the controls on her hardware (it mirrors the manual
double-click-titlebar that she found worked).
ENTRACTE_WL_FIX selects the strategy so a different compositor can be
handled empirically without a rebuild:
maximize(default):maximize()thenunmaximize()on a later tick — the confirmed fix.nudge: resize +1px, restore on a later tick (the 0.0.6 idea, fixed to actually commit). Kept as an alternative for compositors maximize perturbs.off: do nothing (baseline / opt-out).
Applied only on a real Wayland session: X11 gives a proper
configure on show() and must not get a spurious maximise flash.
Enums§
- Wayland
Fix - Which #139 Wayland workaround to apply when showing the
mainwindow.
Constants§
- DEFER_
MS 🔒 - Delay before the deferred half of a nudge/maximize round-trip, long enough for the compositor to process and commit the intermediate surface state before we restore it.
- WL_
FIX_ 🔒ENV - Env var selecting the Wayland configure workaround strategy. Honoured only on a Linux Wayland session; ignored elsewhere.
Functions§
- apply_
wayland_ 🔒fix - Apply the selected #139 workaround to a freshly-shown
mainwindow. Reached only on a Linux Wayland session (seeshow_main_window); the nudge/maximize strategies defer their second half onto a later event-loop tick because Wayland coalesces state set within a single turn — the flaw that made the 0.0.6 synchronous nudge a no-op. - close_
pause_ window - Close the “Pause until…” picker. Invoked by the picker itself after it
pauses or the user cancels. A backend command (rather than the JS window
API) keeps
@tauri-apps/api/windowout of the renderer bundle. - is_
wayland_ 🔒session - Whether this is a Wayland session, from the process environment.
- nudged_
dimension 🔒 - The one transient intermediate size the
nudgestrategy resizes to before restoring the real size, to provoke a fresh compositor configure event. Grow by 1px so the size genuinely changes (a no-op resize is coalesced away); if the window is already at theu32ceiling, shrink instead so the value still differs. - show_
main_ window - Show and focus the
mainwindow, applying the Wayland configure workaround on a Linux Wayland session. Single entry point so every “open Preferences” call site (tray menu, CLI re-invocation) gets identical behaviour. - show_
pause_ window - Show the small “Pause until…” picker, creating it on first use. Launched from the tray; mirrors the overlay’s on-demand window creation. The renderer closes the window after pausing or cancelling, so the next launch builds a fresh one.
- wayland_
fix_ strategy - Resolve the active strategy from the process environment.
- wayland_
session_ 🔒from_ env - Pure Wayland-session test over the two relevant env signals, split out
so the decision is unit-testable without mutating process env. Mirrors
the probes in
scheduler::overlayandvideo; kept local so the window path stays self-contained.