Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deterministic and Configurable Tray Icon Ordering
This PR adds a new feature to the Waybar tray module: stable and user-configurable ordering of tray icons.
Problem
Before this change, tray icons were shown in the order in which applications registered themselves via D-Bus. This caused several issues:
There was no reliable way to control or stabilize this behavior.
What this PR adds
1. Stable default behavior
Even without any configuration, tray icons are now sorted deterministically in alphabetical order based on an internal key (
sort_key).This ensures that:
2. New user configuration options
Users can now explicitly define their preferred tray order using a simple list:
orderallows specifying tray icons in the exact desired orderorder-unknowncontrols whether unconfigured items appear before or after configured onesAvailable keys can be easily discovered via log messages like:
3. Improved handling of Electron apps
Many Electron-based applications register generic tray IDs such as
chrome_status_icon_1.This PR improves that by:
This makes it possible to reliably sort apps like Signal, Vesktop, etc.
How it works internally
Each tray item now provides a stable
sort_keyThe SNI Host component performs centralized reordering
Reordering is triggered automatically when an item identity becomes available
Sorting priority is:
orderThis guarantees deterministic results across all Waybar instances.
Differences to PR #4643
This implementation differs significantly from PR #4643:
Overall, this approach focuses on simplicity and predictable behavior.
Personal note
I want to mention explicitly that I have very limited experience with C++.
This feature was created almost entirely with the help of ChatGPT, which guided me through the design, refactoring, and implementation process step by step.
Feedback and suggestions are very welcome!