fix(linux): migrate to qt tray#4907
Conversation
Bundle ReportBundle size has no change ✅ |
f4eceff to
73ec9c7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4907 +/- ##
==========================================
- Coverage 17.99% 17.96% -0.04%
==========================================
Files 108 108
Lines 23317 23331 +14
Branches 10263 10275 +12
==========================================
- Hits 4197 4191 -6
+ Misses 17092 16726 -366
- Partials 2028 2414 +386
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 55 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
8640c4a to
4ee4ef1
Compare
c741880 to
afcf57b
Compare
59e3a6f to
96224f6
Compare
3b0a290 to
8334eb9
Compare
8334eb9 to
484fe46
Compare
|
|
I've been running this for a few days now and the only minor thing I've noticed is that left clicking (and also double left clicking) is not working for me (on CachyOS-latest, QT6.11.0, KDE 6.6.4) with the following error message in log for every click:
Right clicking is working as expected and everything else also is working fine here so far. |
|
@Kishi85 that looks like an issue that I was aware of and thought was fixed. Probably needs to be fixed in the tray library itself. Not sure double clicking should have any action though. As FYI... When I migrated it I used Claude Sonnet 4.5 and it really struggled, near the end I switched to GPT 5.3-codex which was able to solve a lot more. These were both with Copilot before they crippled everything about the service. I think the new 5.5 model would have no problems with this though. Would probably be better if someone using Linux fixes it because I don't and my testing will be limited. |
|
I'll have a look at it when time permits |
|
A thing I've noted after quickly looking at the change in LizardByte/tray is that the qt based tray icon is trying to call XDG via dbus which is bound to fail (there is a fallback in place it seems but that behaviour might be the cause of my current issues) due to kmsgrab requiring CAP_SYS_ADMIN and the dbus connection therefore not being able to access EDIT: I'll also have to check the differences between the AI approach and upstream's qt6 implementation to see if the latter does anything better and maybe port that as it is already tried and proven for a while (was committed sometime in 2023). |
|
I've looked at the upstream implementation for a bit today and it's a lot simpler (it pulls in 4 includes from QT, not like the 10+ the AI solution does) and also encapsulated into it's own QtTrayMenu class (positioning also works without any special position calculations). |
|
Positioning was required to support the screenshots for tests in the tray library as far as I remember (may not be necessary with the QT version though). The XDG wayland detection was added because the tray was not displaying in headless environments (e.g. Sunshine started from a TTY ssh session without WAYLAND_DISPLAY defined)... drdoom reported that issue on discord. We don't necessarily need to support this method though, as he normally starts it via the service in which case the env variable is properly defined... and expecting it to be ran with a service seems reasonable to me (we also expect that on Windows anyway). Anyway, I'm sure it's not perfect by any means... but the PR in tray library is what finally ended random unit test hangs which were occurring more than 50% of the time before. The screenshots from tests and posted in the PR comments in that library now help identify any major issues before they get merged. I'm sure it can be improved upon and hopefully simplified. Would also be nice to just use QT across all platforms which in my mind would further simplify the whole implementation. When I last worked on this "OpenSUSE Leap 15.x" didn't have qt6 either, not sure if that has changed. If it allows it to greatly simplified though, I'm fine with not supporting qt5. |
Thanks for the explanations and clarifications. I'll use the current state with the AI qt-tray as a starting point for the improvements then. Keeping Qt5 support as well should be no problem as it's essentially the same code for both versions and the cmake config already takes care of selecting the available version. First point of action will be to pull out the Qt tray essentials into a separate class (like upstream does it and I might use that as a starting point for it) which will be fully platform independent (only dependency will be Qt) so at least that can be re-used. I'll open up a PR in the tray repo once I'm done with that. |



Description
Migrates system tray library on Linux to use Qt version, from LizardByte/tray#104
TODO:
...replacement)WAYLAND_DISPLAYwas not defined)Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage