Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix: reassert window icon on show so autostart taskbar icon recovers
Tw9383a1c476ddd2
diff --git a/src-tauri/src/app/setup.rs b/src-tauri/src/app/setup.rsindex 9ca25157..12edfc29 100644--- a/src-tauri/src/app/setup.rs+++ b/src-tauri/src/app/setup.rs@@ -1,4 +1,4 @@-use crate::app::window::open_additional_window_safe;+use crate::app::window::{open_additional_window_safe, reapply_window_icon};use std::str::FromStr;use std::sync::{Arc, Mutex};use std::time::{Duration, Instant};@@ -56,6 +56,7 @@ pub fn set_system_tray("show_app" => {if let Some(window) = app.get_webview_window("pake") {let _ = window.show();+ reapply_window_icon(&window);#[cfg(target_os = "linux")]if _init_fullscreen && !window.is_fullscreen().unwrap_or(false) {let _ = window.set_fullscreen(true);@@ -83,6 +84,7 @@ pub fn set_system_tray(let _ = window.hide();} else {let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();#[cfg(target_os = "linux")]if _init_fullscreen && !window.is_fullscreen().unwrap_or(false) {@@ -153,6 +155,7 @@ pub fn set_global_shortcut(let _ = window.hide();} else {let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();#[cfg(target_os = "linux")]if _init_fullscreen && !window.is_fullscreen().unwrap_or(false) {diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rsindex cef79957..6e8a2c77 100644--- a/src-tauri/src/app/window.rs+++ b/src-tauri/src/app/window.rs@@ -69,6 +69,21 @@ pub fn open_additional_window(app: &AppHandle) -> tauri::Result<WebviewWindow> {build_window_with_label(app, &state.pake_config, &state.tauri_config, &label)}+// Apps autostarted at Windows logon can register their window icon before+// Explorer's icon cache is ready, leaving a blank taskbar icon until the icon+// is asserted again (#1323), so re-apply it whenever a window becomes visible.+#[cfg(target_os = "windows")]+pub fn reapply_window_icon(window: &WebviewWindow) {+ if let Some(icon) = window.app_handle().default_window_icon().cloned() {+ if let Err(error) = window.set_icon(icon) {+ eprintln!("[Pake] Failed to re-apply window icon: {error}");+ }+ }+}++#[cfg(not(target_os = "windows"))]+pub fn reapply_window_icon(_window: &WebviewWindow) {}+struct WindowBuildOptions<'a> {label: &'a str,url: WebviewUrl,diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex d3ed1060..47547dfb 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -25,7 +25,7 @@ use app::{set_dock_badge_label, set_zoom, update_theme_mode,},setup::{set_global_shortcut, set_system_tray},- window::{open_additional_window_safe, set_window, MultiWindowState},+ window::{open_additional_window_safe, reapply_window_icon, set_window, MultiWindowState},};use util::get_pake_config;@@ -179,6 +179,7 @@ pub fn run_app() {} else if let Some(window) = app.get_webview_window("pake") {let _ = window.unminimize();let _ = window.show();+ reapply_window_icon(&window);let _ = window.set_focus();}},@@ -231,6 +232,7 @@ pub fn run_app() {tauri::async_runtime::spawn(async move {tokio::time::sleep(tokio::time::Duration::from_millis(WINDOW_SHOW_DELAY)).await;let _ = window_clone.show();+ reapply_window_icon(&window_clone);// Fixed: Linux fullscreen issue with virtual keyboard#[cfg(target_os = "linux")]