mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 08:18:39 +00:00
Tray icon: window toggle, minimize state, and geometry are unreliable on native Wayland #748
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml#748
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The desktop tray icon and window-behavior work added in #746 behaves correctly on X11/XCB, but three behaviors do not work reliably on a native Wayland session because they rely on window information Wayland does not expose to applications. This is a platform limitation, not a regression: the obscured-detection behavior is unavailable on Wayland in Core's Qt Widgets GUI as well, for the same reason. The behaviors are correct when the app runs under XCB (including XWayland).
Parent: #513
Problem
DesktopTrayIconControllerports Bitcoin Core's Qt Widgets tray logic, whichdetermines window state with
GUIUtil::isObscured()(QApplication::widgetAt()).The QML port uses the
QWindowequivalent,QGuiApplication::topLevelAt(). OnWayland the compositor deliberately prevents apps from inspecting other apps'
windows or global stacking, so
topLevelAt()always returns the app's ownwindow,
showMinimized()does not report aMinimizedvisibility, and thecompositor re-applies frame margins on
show(). Each of these breaks one of theported behaviors.
Observed vs. expected behavior
Verified by driving the running app through each window state under both
QT_QPA_PLATFORM=xcbandQT_QPA_PLATFORM=wayland:ShowHideShowReproduction
On a native Wayland session (e.g. GNOME/COSMIC Wayland), with the tray icon
enabled in Settings → Window Behavior:
window, then single-click the tray icon. The window hides instead of coming
to the front; a second click is required to show it.
icon. The menu action reads
Hideinstead ofShow.The window grows wider on each cycle and controls become misaligned;
maximizing/restoring resets it.
All three behave correctly under
QT_QPA_PLATFORM=xcb.Likely cause
QGuiApplication::topLevelAt()returnsnullptrforpoints covered by another application only under XCB. On Wayland it returns the
app's own window, so
isObscured()is alwaysfalseandtoggleWindow()takes the hide branch. This is the same limitation Core's widget GUI has on
Wayland (
widgetAt()cannot see foreign windows either) and is rooted in theWayland security model — see bitcoin/bitcoin#19950.
windowVisibleBindingderives the menu label fromappWindow.visibility. On WaylandshowMinimized()leavesvisibilityatWindow.Windowedrather thanWindow.Minimized, so the binding staystrue.QWindow::show()afterhide()does not preserve geometryon Wayland the way
QWidget::show()does; the compositor re-adds frame marginseach cycle. Likely the same class of Wayland windowing instability as
bitcoin/bitcoin#33432.
Work Needed
it cannot be solved in application code on Wayland.
toggleWindow()minimized check from anexplicit state tracked in
onVisibilityChangedrather than relying solely onQWindow::visibility, so the minimized case is correct on Wayland.size on show, or suppressing transient
onWidthChanged/onHeightChangedwrites during state transitions) and confirm it does not reintroduce the XCB
setGeometry()/WM conflict.offscreen QPA backend used by the unit/functional tests cannot exercise any of
this.
Code References
qml/models/desktoptrayiconcontroller.cppisObscured()/checkPoint()(usesQGuiApplication::topLevelAt())toggleWindow()setWindowVisible()qml/pages/main.qmlwindowVisibleBindingonVisibilityChangedonXChanged/onYChanged/onWidthChanged/onHeightChanged) andComponent.onCompletedrestoreRelated
[Linux] Add wayland support(root cause: Wayland blocks cross-app window access; release binaries are XCB-only)