fix(tray): set icon as template after build

This commit is contained in:
Vlad Gerasimov 2025-07-28 18:59:11 +04:00
parent 609fc7667b
commit 1c61d3b6b1
2 changed files with 4 additions and 3 deletions

View file

@ -92,7 +92,7 @@ pub fn run() {
.icon(Image::from_path(app.path().resolve(
"resources/tray_idle.png",
tauri::path::BaseDirectory::Resource,
)?)?.as_template(true))
)?)?)
.menu(&menu)
.show_menu_on_left_click(true)
.on_menu_event(|app, event| match event.id.as_ref() {
@ -128,6 +128,7 @@ pub fn run() {
_ => {}
})
.build(app)?;
let _ = tray.set_icon_as_template(true);
app.manage(tray);
// Get the autostart manager

View file

@ -91,9 +91,9 @@ pub fn change_tray_icon(app: &AppHandle, icon: TrayIconState) {
.resolve(icon_path, tauri::path::BaseDirectory::Resource)
.expect("failed to resolve"),
)
.expect("failed to set icon")
.as_template(true),
.expect("failed to set icon"),
));
let _ = tray.set_icon_as_template(true);
}
/// Plays an audio resource from the resources directory.