Tray context menu opens far left of the icon on a monitor with a non-zero x position (multi-monitor, niri)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- desktop
Research direction
The offset comes from showForTrayItemAtGlobalPoint in quickshell/Modules/DBar/Widgets/SystemTrayBar.qml, which subtracts screen.x and screen.y from a point produced by anchor.mapToGlobal in showForTrayItem. Start by logging both values on a bar whose screen has a non-zero x to see whether mapToGlobal is already screen-local. Compare with BarWidgetService.naturalPopoutAnchor, which uses mapToItem(null, ...). Done means the tray menu opens under the clicked icon on a non-zero-x monitor and still opens correctly on the monitor at 0,0.
Written by the indexing model from the issue text.
Description
Compositor: niri 26.04 (8ed0da4)
Distribution: CachyOS
Installation method: distro package dux-shell 2.1.2-1.1 (CachyOS repo). Original install method: yes.
dms doctor -vC:
System Health Check
──────────────────────────────────────
System
● Operating System ····· CachyOS
└─ ID: cachyos, Version: rolling, Arch: amd64
● Architecture ········· amd64
● Display Server ······· Wayland
└─ WAYLAND_DISPLAY=wayland-1
Versions
● DMS CLI ·············· dms v2.1.2
└─ /usr/bin/dms
● Quickshell ··········· Quickshell 0.3.2 (revision , distributed by Arch Linux)
└─ /usr/bin/qs
● DMS Shell ············ v2.1.2
└─ /run/user/1000/dms-shell/13e2e34644f9af14
Installation
● DMS Configuration ···· Found
└─ /run/user/1000/dms-shell/13e2e34644f9af14
● shell.qml ············ Present
└─ /run/user/1000/dms-shell/13e2e34644f9af14/shell.qml
○ Install Type ········· Unknown
└─ /run/user/1000/dms-shell/13e2e34644f9af14
Compositor
● niri ················· 26.04
└─ /usr/bin/niri
○ Active ··············· niri
● Background Blur ······ Supported
└─ Compositor supports ext-background-effect-v1
Quickshell Features
● Polkit ··············· Available
└─ Authentication prompts
● IdleMonitor ·········· Available
└─ Idle detection
● IdleInhibitor ········ Available
└─ Prevent idle/sleep
● ShortcutInhibitor ···· Available
└─ Allow shortcut management (niri)
● BackgroundBlur ······· Available
└─ Background blur API support in Quickshell
Optional Features
● accountsservice ······ Available
└─ User accounts
● power-profiles-daemon Available
└─ Power profile management
● logind ··············· Available
└─ Session management
● cups-pk-helper ······· Available
└─ Printer management
● I2C/DDC ·············· 2 monitor(s) detected
└─ External monitor brightness control
● qt6-imageformats ····· Installed (4 formats)
└─ Formats: WebP, TIFF, GIF, ICNS (/usr/lib/qt6/plugins/imageformats:/usr/lib64/qt6/plugins/imageformats)
● kimageformats ········ Installed (4 formats)
└─ Formats: AVIF, HEIF, JXL, EXR (/usr/lib/qt6/plugins/imageformats:/usr/lib64/qt6/plugins/imageformats)
● Terminal ············· wezterm
● Network ·············· NetworkManager
└─ NetworkManager present. Using NM API.
● matugen ·············· Installed
└─ Dynamic theming
● cava ················· Installed
└─ Audio visualizer
● khal ················· Installed
└─ Calendar events
● dux-search ··········· Installed
└─ File search
● dux-calendar ········· Installed
└─ Calendar app
● dux-files ············ Installed
└─ File manager
● fprintd ·············· Installed
└─ Fingerprint auth
● adw-gtk3 ············· Installed
└─ GTK3 dynamic theming (user copy)
Config Files
● settings.json ········ Present
└─ /home/bayar/.config/dms/settings.json
● clsettings.json ······ Present
└─ /home/bayar/.config/dms/clsettings.json
● plugin_settings.json · Present
└─ /home/bayar/.config/dms/plugin_settings.json
● session.json ········· Present
└─ /home/bayar/.local/state/dms/session.json
● dms-colors.json ······ Present
└─ /home/bayar/.cache/dms/dms-colors.json
Services
● dms.service ·········· enabled, active
└─ Wanted by niri.service
● greetd ··············· enabled
● xdg-desktop-portal ··· Settings portal reachable
Environment
○ QT_QPA_PLATFORMTHEME · gtk3
● gtk3 plugin (Qt6) ···· Installed
└─ /usr/lib/qt6/plugins/platformthemes/libqgtk3.so
○ QT_QPA_PLATFORMTHEME… gtk3
○ QS_ICON_THEME ········ Not set
○ XDG_MENU_PREFIX ······ Not set
Fonts
● Normal Font ·········· Google Sans Flex
└─ /run/user/1000/dms-shell/13e2e34644f9af14/DCommon/assets/fonts/google-sans-flex/GoogleSansFlex.ttf
● Monospace Font ······· JetBrains Mono
└─ Available via fontconfig
● Display Font ········· Young Serif
└─ Available via fontconfig
──────────────────────────────────────
✓ All checks passed!
Description
Right-clicking a system tray icon on a bar that sits on my second monitor opens the tray menu roughly in the middle of the bar instead of under the icon. The horizontal offset matches that monitor's logical x position (1080 px).
Layout:
- DP-2: portrait monitor, logical 1080x1920, logical position 0,0
- DP-3: main monitor, logical 2560x1440, logical position 1080,276. The bar with the System Tray widget is on this one.
I think the monitor offset is subtracted twice. In quickshell/Modules/DBar/Widgets/SystemTrayBar.qml, showForTrayItem gets the point with anchor.mapToGlobal(0, anchorY), and showForTrayItemAtGlobalPoint then does:
const localPos = Qt.point(gx - (screen.x || 0), gy - (screen.y || 0));
On this setup the menu lands about screen.x pixels left of the icon, which suggests mapToGlobal on the bar's layer surface already returns screen-local coordinates here. Bars on the monitor at 0,0 are not affected, so single-monitor setups would not show this. Other code in the shell builds popup anchors with mapToItem(null, ...) (for example BarWidgetService.naturalPopoutAnchor), which avoids the conversion. I have not tested a patch, so treat the root cause as a guess.
Expected Behavior
The tray context menu opens under the icon that was right-clicked, on every monitor.
Steps to Reproduce
- Set up two monitors in niri so the monitor holding the bar has a non-zero logical x (here a 1080 px wide portrait monitor sits to its left).
- Put the System Tray widget on that monitor's bar (top position, right section).
- Right-click any tray icon that has a menu (Proton Mail Bridge here).
- The menu opens about 1080 px left of the icon, near the middle of the bar.
Error Messages/Logs
None seen.
Screenshots/Recordings
Screenshot to follow in a comment.
- Dominant language
- QML
- Stars
- 8.4k
- Forks
- 549
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AvengeMedia/DankMaterialShell
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AvengeMedia/DankMaterialShell#4490 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AvengeMedia/DankMaterialShell#4481 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AvengeMedia/DankMaterialShell#4465 ·
-
Enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AvengeMedia/DankMaterialShell#4456 · 2 comments ·
-
Enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AvengeMedia/DankMaterialShell#4452 ·
All issues in AvengeMedia/DankMaterialShell
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SubtitleEdit/subtitleedit#17351 ·
Maintainers usually reply within 1 day
-
os:Windows
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug :bug:
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Nouuu/Albion-Online-OpenRadar#243 ·