Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux tray applet menu doesn't respect HiDPI scaling #4

Closed
ohthehugemanatee opened this issue Feb 28, 2020 · 2 comments
Closed

Linux tray applet menu doesn't respect HiDPI scaling #4

ohthehugemanatee opened this issue Feb 28, 2020 · 2 comments

Comments

@ohthehugemanatee
Copy link

Describe the bug
When starting pia-client in XWindows on a HiDPI display, the PIA Window respects QT scaling environment variables, but the tray icon's menu does not.

To Reproduce
Steps to reproduce the behavior:

  1. Start pia-client on a HiDPI machine.
  • Note the QT scaling variables listed in stdout.
  • Note that the primary window is properly scaled.
  1. Right-click on the tray icon
  2. Observe the teeny tiny, non-scaled menu.

Expected behavior
The tray menu should observe the same scaling rules as the app window.

Observed on:

  • OS: Manjaro Linux
  • Version: current
  • Environment: i3wm on XWindows.

Output of pia-client:

pia-client                                                                   
[+0.001][json.settings][json.cpp:344][debug] Successfully read clientsettings.json
[+0.001][default][linux_env.cpp:21][info] XDG_CURRENT_DESKTOP= "i3"
[+0.001][default][linux_env.cpp:69][info] Detected desktop "Unknown" and RTL: false
[+0.012][default][builtin/util.cpp:228][info] Initializing crash handler
[+0.012][logger][builtin/logging.cpp:226][info] Initializing LoggerPrivate
[+0.012][logger][builtin/logging.cpp:272][info] No debug.txt found; using default filter rules
[+0.024][default][client.cpp:399][info] Changed to locale "en-US"
[+0.217][default][client.cpp:794][info] Client connected, loading UI
[+0.289][qml][qrc:/components/dashboard/connect/ModuleSorter.qml:196][info] Added missing module snooze
[+0.321][qml][qrc:/components/dashboard/ChangelogWindow.qml:27][info] Changelog height: 41
[+0.378][qml][qrc:/components/settings/pages/NetworkPage.qml:234][info] errors: []
[+0.845][qml][qrc:/components/dashboard/ChangelogWindow.qml:27][info] Changelog height: 3284
[+0.862][NativeTrayQt][nativetrayqt.cpp:432][info] guess tray icon QRect(4991,60 1x1) with screen QRect(0,0 4992x3120) and work area QRect(0,60 4992x3060)
[+0.872][linuxscaler][linux_scaler.cpp:34][info] Scale from "QT_SCALE_FACTOR"="3" -> 3
[+0.881][linuxscaler][linux_scaler.cpp:197][info] DPI setting '"Xft.dpi:\t288"' from xrdb results in scale -> 3
[+0.881][linuxscaler][linux_scaler.cpp:224][info] Scale factors:
[+0.881][linuxscaler][linux_scaler.cpp:225][info]  - PIA: 0
[+0.881][linuxscaler][linux_scaler.cpp:226][info]  - gsettings: 0
[+0.881][linuxscaler][linux_scaler.cpp:227][info]  - Qt: 3
[+0.881][linuxscaler][linux_scaler.cpp:228][info]  - Qt(screen): 0
[+0.881][linuxscaler][linux_scaler.cpp:229][info]  - Xft.dpi: 3
[+0.883][windowscaler][windowscaler.cpp:49][info] scale changed: 1 -> 3
[+0.894][windowscaler][windowscaler.cpp:49][info] scale changed: 1 -> 3
[+0.911][windowscaler][windowscaler.cpp:49][info] scale changed: 1 -> 3
[+0.937][windowscaler][windowscaler.cpp:49][info] scale changed: 1 -> 3
[+0.945][windowscaler][windowscaler.cpp:49][info] scale changed: 1 -> 3
[+1.017][default][window.cpp:346][info] window "Connect" focus false -> true
@JonathonH-PIA
Copy link
Contributor

This works for desktop environments that support StatusNotifierItem tray icons (the DE renders the menu in that case), but i3bar only supports XEmbed. (I'm assuming you're using i3bar with i3wm.)

Ideally, i3bar should implement StatusNotifierItem, XEmbed icons have other problems too. It does not look like there is any movement on that: i3/i3#2088

Qt does fall back to an XEmbed tray implementation, and it might support scaling, but we disable Qt's scaling due to various issues that it had. We implement it ourselves for the app windows. The tray icon was overlooked since scaling is not needed for SNI, but we probably cannot enable Qt's scaling only for the XEmbed tray without affecting the app windows.

We may eventually implement tray support directly with StatusNotifierItem on Linux rather than use Qt's abstraction (as it has some other minor issues too), but it is unlikely that we will do this for XEmbed, since very few DEs still use it (we'd still keep the Qt implementation for XEmbed to preserve the functionality that exists).

If you'd like to take a stab at it, you'd need to create a NativeTray implementation using XEmbed: https://github.com/pia-foss/desktop/blob/master/client/src/nativetray.h - also see https://github.com/pia-foss/desktop/blob/master/client/src/linux/nativetrayqt.h

There'd also need to be logic to figure out when to use SNI vs. XEmbed (which is one of the pain points with Qt's implementation).

@JonathonH-PIA
Copy link
Contributor

Closing this due to inactivity - PRs welcome to improve XEmbed behavior, but it's not something we'll work on internally, as i3bar seems to be the only holdout on XEmbed vs. StatusNotifierItem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants