diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index bf8d0205f..e6180ce38 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -280,6 +280,11 @@ pub fn run() { network::media_protocol::respond, ) .setup(|app| { + // CEF is initialized during runtime construction; initialize GTK afterward + // on the main thread for the Linux tray menu. + #[cfg(all(feature = "cef", target_os = "linux"))] + gtk::init()?; + network::native_upload::cleanup_uploads(app.handle()); #[cfg(any(target_os = "linux", all(debug_assertions, windows)))] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index ad45998c1..554f4dd6a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -16,14 +16,14 @@ fn main() { ], deep_link_schemes: vec!["moe.sable.app".into(), "sable".into()], command_line_args: vec![ - ("disable-gpu-sandbox".into(), None), - ("disable-font-subpixel-positioning".into(), None), - ("enable-font-antialiasing".into(), None), + ("--disable-gpu-sandbox".into(), None), + ("--disable-font-subpixel-positioning".into(), None), + ("--enable-font-antialiasing".into(), None), ("autoplay-policy".into(), Some("no-user-gesture-required".into())), ("enable-features".into(), Some("SharedArrayBuffer".into())), - ("disable-background-timer-throttling".into(), None), - ("disable-renderer-backgrounding".into(), None), - ("disable-backgrounding-occluded-windows".into(), None), + ("--disable-background-timer-throttling".into(), None), + ("--disable-renderer-backgrounding".into(), None), + ("--disable-backgrounding-occluded-windows".into(), None), ("disable-features".into(), Some( "SpareRendererForSitePerProcess,IntensiveWakeUpThrottling,CalculateNativeWinOcclusion,AutofillActorMode,GlicActorUi,LensOverlay".into() )), @@ -148,12 +148,6 @@ fn main() { } } - // CEF doesn't init GTK, but the Linux tray menu needs it. - #[cfg(all(feature = "cef", target_os = "linux"))] - { - let _ = gtk::init(); - } - // Deep-link primary: hold the forwarding socket for the process lifetime. #[cfg(all(feature = "cef", target_os = "linux"))] let _deep_link_guard = app_lib::deep_link_ipc::bind_and_listen();