Ignore Tray items by service name and when dbus properties load#4826
Open
AntGarSil wants to merge 1 commit intoAlexays:masterfrom
Open
Ignore Tray items by service name and when dbus properties load#4826AntGarSil wants to merge 1 commit intoAlexays:masterfrom
AntGarSil wants to merge 1 commit intoAlexays:masterfrom
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.
Description
Implements configuration-based filtering of system tray (StatusNotifierItem) icons in Waybar. Users can now specify patterns to hide unwanted tray items via the
ignore-listconfiguration option.Problem Statement
Some applications (e.g., blueman, network managers) show system tray icons that cannot be disabled through the application's own settings. Users need a way to filter these unwanted icons at the Waybar level.
Solution
Added ignore-list functionality that filters SNI items based on pattern matching against service names, object paths, and item properties.
Changes
src/modules/sni/host.cppNew Methods:
checkIgnoreList()- Filters and removes items matching ignore patternsbus_name,category,icon_name,id,titleon_removecallback and erases matched itemsModified Methods:
Host::Host()constructor - Addedignore_listparameteritemRegistered()- Added logging for item registration eventsaddRegisteredItem()- Enhanced debug loggingConstructor Signature Change:
src/modules/sni/tray.cppNew Methods:
parseIgnoreList()- Static helper to parse JSON config arraycheckIgnoreList()- Public wrapper delegating to Host's methodNew Member Variables:
std::vector<std::string> ignore_list_- Stores ignore patternsModified Methods:
Tray::Tray()constructor - Initializesignore_list_from configonAdd()- Calls deferred ignore check after adding item, enhanced loggingupdate()- Periodic ignore list check to catch late-loading propertiesConfiguration Usage
{ "tray": { "ignore-list": ["blueman", "nm-applet", "spotify"] } }Patterns are matched using substring search (
std::string::find()) against multiple item fields.Technical Details
Logging Added
Known Problems
The current implementation has a timing problem:
onAdd()is called, properties (category,icon_name,title) are empty stringsExample from logs:
The code now checks patterns against the
serviceparameter (e.g.,:1.628/org/blueman/sni) inaddRegisteredItem()before Item construction, as this value is immediately available.Testing
Breaking Changes
None - added functionality is opt-in via configuration.
Related Issues
#2842