Tray context menu opens far left of the icon on a monitor with a non-zero x position (multi-monitor, niri)

Aperta
#4,408 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
desktop

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

  1. 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).
  2. Put the System Tray widget on that monitor's bar (top position, right section).
  3. Right-click any tray icon that has a menu (Proton Mail Bridge here).
  4. 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.

Lingua principale
QML
Stelle
8.4k
Fork
549
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AvengeMedia/DankMaterialShell

Tutte le issue di AvengeMedia/DankMaterialShell

Issue simili

Altre issue su Desktop Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.