diff --git a/src/stub.rs b/src/stub.rs index 4c3f14c..d826adb 100644 --- a/src/stub.rs +++ b/src/stub.rs @@ -5,15 +5,16 @@ use std::fs::File; use std::io::{BufReader, Read}; use std::io::{Cursor, Seek}; use std::path::Path; + +#[cfg(target_os = "windows")] use tao::platform::windows::WindowBuilderExtWindows; -use tao::window::Icon; + use tao::{ event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, - window::WindowBuilder, + window::{Icon, WindowBuilder}, }; -use wry::WebContext; -use wry::{http::header::CONTENT_TYPE, WebViewBuilder}; +use wry::{http::header::CONTENT_TYPE, WebContext, WebViewBuilder}; use zip::ZipArchive; static APP_UUID: &str = "39abaebb-57b1-4c12-ab88-321fd7a93354"; @@ -86,11 +87,15 @@ fn main() -> wry::Result<()> { let event_loop = EventLoop::new(); let window = WindowBuilder::new() .with_title(format!("um-react-wry 桌面客户端 - {}", version_suffix)) - .with_maximized(true) - .with_window_icon(Some(load_icon(include_bytes!("um-react@16.webp")))) - .with_taskbar_icon(Some(load_icon(include_bytes!("um-react@192.webp")))) - .build(&event_loop) - .unwrap(); + .with_maximized(true); + + #[cfg(target_os = "windows")] + let window = window.with_taskbar_icon(Some(load_icon(include_bytes!("um-react@192.webp")))); + + let window = window.build(&event_loop).unwrap(); + + #[cfg(any(target_os = "windows", target_os = "linux"))] + window.set_window_icon(Some(load_icon(include_bytes!("um-react@16.webp")))); #[cfg(any( target_os = "windows",