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

Abierto
#4,408 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Área
desktop

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
QML
Estrellas
8.4k
Forks
549
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AvengeMedia/DankMaterialShell

Todos los issues de AvengeMedia/DankMaterialShell

Issues similares

Más issues de Desktop Dev

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.