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

Features/systray custom icons #3941

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ChaosInfinited
Copy link

@ChaosInfinited ChaosInfinited commented Feb 16, 2025

Hello o/

I really dislike having random-looking systray icons, and I saw that others were looking for a way to customize them—so I decided to take a stab at adding some (very rudimentary) support for this.

Related issue: #1957 (it's more about themes, but figured there's no harm in linking it, in case it's good enough solution)

This isn't the cleanest solution, but it does work—at least for non-Electron apps. (Electron seems to have its own issues: electron/electron#40936).

This implementation allows users to override tray icons through their config, following the suggestion in #1400.

"tray": {
	"icon-size": 21,
	"spacing": 10,
	"icons": {
	    "blueman": "bluetooth",
	    "TelegramDesktop": "$HOME/.local/share/icons/hicolor/16x16/apps/telegram.png"
	}
}

A couple of limitations:

  • I could only make this work with actual image files, not font-based icons. The latter would likely require major changes to the current tray implementation.
  • The icons are set before the item's ID is known, so I had to add the override (with a check to ensure it's applicable) when the ID is received via DBus.
  • Users can match icons using either a system-wide recognized icon_name or by specifying a direct file path.

To avoid unnecessary config reloading, I also introduced a per-tray icon manager singleton, since there wasn't a good place where both the config and the item ID were accessible at the same time.

Maybe it'd be useful for someone :) Let me know if you have some suggestions

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

Successfully merging this pull request may close these issues.

1 participant