tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
78.1k stars 2.31k forks source link

[feat] SystemTray icon theming #9690

Open Darkhogg opened 1 week ago

Darkhogg commented 1 week ago

Describe the problem

Currently, the system tray created by Tauri directly references an image file, and will therefore only show that particular image in the system tray. This will ignore the configured user icon theme.

Describe the solution you'd like

The system tray configuration and any SystemTray methods that allow for icon manipulation should have a way of providing an icon name to use, as well as an image file as a fallback for themes that don't have that icon or platforms that don't support theming.

Alternatives considered

No response

Additional context

On Linux, applications are expected to provide an icon name for the system tray, which will be used to look up the correct icon from the current icon theme with context on image type support, display size, etc. In general, applications should install their icons on the hicolor theme and not use any hardcoded images, but most tray implementations allow for an image fallback from outside the themes path.

Tauri, however, uses hardcoded images only, which means users don't get the icon from their selected theme, and that icon won't be selected according to display size or image format support (i.e., might not be properly scaled, or might not be displayed at all if the tray doesn't support its format).