fix(tray): set icon as template after build
This commit is contained in:
parent
609fc7667b
commit
1c61d3b6b1
2 changed files with 4 additions and 3 deletions
|
|
@ -92,7 +92,7 @@ pub fn run() {
|
||||||
.icon(Image::from_path(app.path().resolve(
|
.icon(Image::from_path(app.path().resolve(
|
||||||
"resources/tray_idle.png",
|
"resources/tray_idle.png",
|
||||||
tauri::path::BaseDirectory::Resource,
|
tauri::path::BaseDirectory::Resource,
|
||||||
)?)?.as_template(true))
|
)?)?)
|
||||||
.menu(&menu)
|
.menu(&menu)
|
||||||
.show_menu_on_left_click(true)
|
.show_menu_on_left_click(true)
|
||||||
.on_menu_event(|app, event| match event.id.as_ref() {
|
.on_menu_event(|app, event| match event.id.as_ref() {
|
||||||
|
|
@ -128,6 +128,7 @@ pub fn run() {
|
||||||
_ => {}
|
_ => {}
|
||||||
})
|
})
|
||||||
.build(app)?;
|
.build(app)?;
|
||||||
|
let _ = tray.set_icon_as_template(true);
|
||||||
app.manage(tray);
|
app.manage(tray);
|
||||||
|
|
||||||
// Get the autostart manager
|
// Get the autostart manager
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,9 @@ pub fn change_tray_icon(app: &AppHandle, icon: TrayIconState) {
|
||||||
.resolve(icon_path, tauri::path::BaseDirectory::Resource)
|
.resolve(icon_path, tauri::path::BaseDirectory::Resource)
|
||||||
.expect("failed to resolve"),
|
.expect("failed to resolve"),
|
||||||
)
|
)
|
||||||
.expect("failed to set icon")
|
.expect("failed to set icon"),
|
||||||
.as_template(true),
|
|
||||||
));
|
));
|
||||||
|
let _ = tray.set_icon_as_template(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Plays an audio resource from the resources directory.
|
/// Plays an audio resource from the resources directory.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue