[GH-ISSUE #1024] Barrier waits for the systray at startup when this isn't required as Qt can do this internally #813

Open
opened 2026-05-05 07:10:38 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @ahayzen on GitHub (Jan 16, 2021).
Original GitHub issue: https://github.com/debauchee/barrier/issues/1024

Describe the bug
Barrier puts QSystemTrayIcon::isSystemTrayAvailable() in a loop waiting for 10 seconds, this is a large amount of time to wait for a system which doesn't have a system tray. ( d4382b9b80/src/gui/src/main.cpp (L129) )

Furthermore the Qt docs state that "If the system tray is currently unavailable but becomes available later, QSystemTrayIcon will automatically add an entry in the system tray if it is visible." https://doc.qt.io/qt-5/qsystemtrayicon.html#isSystemTrayAvailable

So it appears that this wait isn't required, as if the system tray becomes available later Qt will automatically show it.

To Reproduce

Steps to reproduce the behavior:

  1. Have a Desktop Shell without a system tray
  2. Launch Barrier
  3. Notice you have to wait a long time for Barrier to start

Expected behavior
At step 3 I expected Barrier to instantly.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Barrier version: 2.3.3
Originally created by @ahayzen on GitHub (Jan 16, 2021). Original GitHub issue: https://github.com/debauchee/barrier/issues/1024 **Describe the bug** Barrier puts `QSystemTrayIcon::isSystemTrayAvailable()` in a loop waiting for 10 seconds, this is a large amount of time to wait for a system which doesn't have a system tray. ( https://github.com/debauchee/barrier/blob/d4382b9b80edc6d81f8257d60ebf7210629d4377/src/gui/src/main.cpp#L129 ) Furthermore the Qt docs state that "If the system tray is currently unavailable but becomes available later, QSystemTrayIcon will automatically add an entry in the system tray if it is visible." https://doc.qt.io/qt-5/qsystemtrayicon.html#isSystemTrayAvailable So it appears that this wait isn't required, as if the system tray becomes available later Qt will automatically show it. **To Reproduce** Steps to reproduce the behavior: 1. Have a Desktop Shell without a system tray 2. Launch Barrier 3. Notice you have to wait a long time for Barrier to start **Expected behavior** At step 3 I expected Barrier to instantly. **Desktop (please complete the following information):** - OS: Ubuntu 20.04 - Barrier version: 2.3.3
Author
Owner

@curiousercreative commented on GitHub (Mar 2, 2021):

@ahayzen any chance you can submit a PR for this? I'm experiencing this as well and can try to test a fix

<!-- gh-comment-id:788548102 --> @curiousercreative commented on GitHub (Mar 2, 2021): @ahayzen any chance you can submit a PR for this? I'm experiencing this as well and can try to test a fix
Author
Owner

@ahayzen commented on GitHub (Mar 2, 2021):

@curiousercreative I've created a pull request here https://github.com/debauchee/barrier/pull/1084 which changes how the waiting works, which should ensure good UX in the majority of cases. Feel free to test it :-)

<!-- gh-comment-id:789299808 --> @ahayzen commented on GitHub (Mar 2, 2021): @curiousercreative I've created a pull request here https://github.com/debauchee/barrier/pull/1084 which changes how the waiting works, which should ensure good UX in the majority of cases. Feel free to test it :-)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#813
No description provided.