diff --git a/.changes/build-do-not-copy-tray-icon.md b/.changes/build-do-not-copy-tray-icon.md new file mode 100644 index 000000000..13bc962f0 --- /dev/null +++ b/.changes/build-do-not-copy-tray-icon.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch +--- + +Do not copy the tray icon to the output directory on Linux since it is embedded in the binary. diff --git a/.changes/core-remove-tray-icon.md b/.changes/core-remove-tray-icon.md new file mode 100644 index 000000000..9919b6635 --- /dev/null +++ b/.changes/core-remove-tray-icon.md @@ -0,0 +1,7 @@ +--- +"tauri": patch +"tauri-codegen": patch +--- + +**Breaking change:** The `TrayIcon` enum has been removed and now `Icon` is used instead. +This allows you to use more image formats and use embedded icons on Linux. diff --git a/.changes/debian-remove-tray-icon.md b/.changes/debian-remove-tray-icon.md new file mode 100644 index 000000000..d7f78f971 --- /dev/null +++ b/.changes/debian-remove-tray-icon.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Removed the tray icon from the Debian and AppImage bundles since they are embedded in the binary now. diff --git a/.changes/runtime-icon-refactor.md b/.changes/runtime-icon-refactor.md new file mode 100644 index 000000000..52a83f9f5 --- /dev/null +++ b/.changes/runtime-icon-refactor.md @@ -0,0 +1,6 @@ +--- +"tauri-runtime": patch +"tauri-runtime-wry": patch +--- + +Removed `TrayIcon` and renamed `WindowIcon` to `Icon`, a shared type for both icons. diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 25226ec11..e68cc466d 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -266,12 +266,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> { )?; } - #[allow(unused_mut)] + #[allow(unused_mut, clippy::redundant_clone)] let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default(); - #[cfg(target_os = "linux")] - if let Some(tray) = config.tauri.system_tray { - resources.push(tray.icon_path.display().to_string()); - } #[cfg(windows)] if let Some(fixed_webview2_runtime_path) = &config.tauri.bundle.windows.webview_fixed_runtime_path { diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index ad9d1df85..83bc7dfb4 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -26,11 +26,7 @@ brotli = { version = "3", optional = true, default-features = false, features = regex = { version = "1.5.6", optional = true } uuid = { version = "1", features = [ "v4" ] } semver = "1" - -[target."cfg(windows)".dependencies] ico = "0.1" - -[target."cfg(target_os = \"linux\")".dependencies] png = "0.17" [features] diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 0cc9f57a4..ec3ba0d7c 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -177,7 +177,6 @@ pub fn context_codegen(data: ContextData) -> Result unimplemented!(), }; - #[cfg(any(windows, target_os = "linux"))] let out_dir = { let out_dir = std::env::var("OUT_DIR") .map_err(|_| EmbeddedAssetsError::OutDir) @@ -193,12 +192,20 @@ pub fn context_codegen(data: ContextData) -> Result Result Result>( root: &TokenStream, out_dir: &Path, @@ -378,14 +357,14 @@ fn ico_icon>( let path = path.as_ref(); let bytes = std::fs::read(&path) - .unwrap_or_else(|_| panic!("failed to read window icon {}", path.display())) + .unwrap_or_else(|_| panic!("failed to read icon {}", path.display())) .to_vec(); let icon_dir = ico::IconDir::read(std::io::Cursor::new(bytes)) - .unwrap_or_else(|_| panic!("failed to parse window icon {}", path.display())); + .unwrap_or_else(|_| panic!("failed to parse icon {}", path.display())); let entry = &icon_dir.entries()[0]; let rgba = entry .decode() - .unwrap_or_else(|_| panic!("failed to decode window icon {}", path.display())) + .unwrap_or_else(|_| panic!("failed to decode icon {}", path.display())) .rgba_data() .to_vec(); let width = entry.width(); @@ -410,7 +389,6 @@ fn ico_icon>( Ok(icon) } -#[cfg(target_os = "linux")] fn png_icon>( root: &TokenStream, out_dir: &Path, @@ -421,12 +399,12 @@ fn png_icon>( let path = path.as_ref(); let bytes = std::fs::read(&path) - .unwrap_or_else(|_| panic!("failed to read window icon {}", path.display())) + .unwrap_or_else(|_| panic!("failed to read icon {}", path.display())) .to_vec(); let decoder = png::Decoder::new(std::io::Cursor::new(bytes)); let mut reader = decoder .read_info() - .unwrap_or_else(|_| panic!("failed to read window icon {}", path.display())); + .unwrap_or_else(|_| panic!("failed to read icon {}", path.display())); let mut buffer: Vec = Vec::new(); while let Ok(Some(row)) = reader.next_row() { buffer.extend(row.data()); @@ -459,7 +437,7 @@ fn find_icon bool>( config_parent: &Path, predicate: F, default: &str, -) -> String { +) -> PathBuf { let icon_path = config .tauri .bundle @@ -468,7 +446,7 @@ fn find_icon bool>( .find(|i| predicate(i)) .cloned() .unwrap_or_else(|| default.to_string()); - config_parent.join(icon_path).display().to_string() + config_parent.join(icon_path) } #[cfg(feature = "shell-scope")] diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index b512826dd..a93a64efc 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -13,7 +13,7 @@ exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" [dependencies] -wry = { version = "0.18.1", default-features = false, features = [ "file-drop", "protocol" ] } +wry = { version = "0.18.3", default-features = false, features = [ "file-drop", "protocol" ] } tauri-runtime = { version = "0.7.0", path = "../tauri-runtime" } tauri-utils = { version = "1.0.0-rc.9", path = "../tauri-utils" } uuid = { version = "1", features = [ "v4" ] } diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 130a423d3..bfe8f4e0e 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -16,8 +16,8 @@ use tauri_runtime::{ dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, FileDropEvent, JsEventListenerKey, PendingWindow, WindowEvent, }, - Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Result, RunEvent, RunIteration, - Runtime, RuntimeHandle, UserAttentionType, UserEvent, WindowIcon, + Dispatch, Error, EventLoopProxy, ExitRequestedEventAction, Icon, Result, RunEvent, RunIteration, + Runtime, RuntimeHandle, UserAttentionType, UserEvent, }; use tauri_runtime::window::MenuEvent; @@ -486,9 +486,9 @@ fn icon_err(e: E) -> Error { Error::InvalidIcon(Box::new(e)) } -impl TryFrom for WryIcon { +impl TryFrom for WryIcon { type Error = Error; - fn try_from(icon: WindowIcon) -> std::result::Result { + fn try_from(icon: Icon) -> std::result::Result { WryWindowIcon::from_rgba(icon.rgba, icon.width, icon.height) .map(Self) .map_err(icon_err) @@ -885,7 +885,7 @@ impl WindowBuilder for WindowBuilderWrapper { self } - fn icon(mut self, icon: WindowIcon) -> Result { + fn icon(mut self, icon: Icon) -> Result { self.inner = self .inner .with_window_icon(Some(WryIcon::try_from(icon)?.0)); @@ -1092,7 +1092,7 @@ pub enum WebviewEvent { pub enum TrayMessage { UpdateItem(u16, MenuUpdate), UpdateMenu(SystemTrayMenu), - UpdateIcon(TrayIcon), + UpdateIcon(Icon), #[cfg(target_os = "macos")] UpdateIconAsTemplate(bool), Close, @@ -1480,7 +1480,7 @@ impl Dispatch for WryDispatcher { ) } - fn set_icon(&self, icon: WindowIcon) -> Result<()> { + fn set_icon(&self, icon: Icon) -> Result<()> { send_user_message( &self.context, Message::Window( @@ -1953,33 +1953,26 @@ impl Runtime for Wry { #[cfg(feature = "system-tray")] fn system_tray(&self, system_tray: SystemTray) -> Result { - let icon = system_tray - .icon - .expect("tray icon not set") - .into_platform_icon(); + let icon = TrayIcon::try_from(system_tray.icon.expect("tray icon not set"))?; let mut items = HashMap::new(); - #[cfg(target_os = "macos")] - let tray = SystemTrayBuilder::new( - icon, + #[allow(unused_mut)] + let mut tray_builder = SystemTrayBuilder::new( + icon.0, system_tray .menu .map(|menu| to_wry_context_menu(&mut items, menu)), - ) - .with_icon_as_template(system_tray.icon_as_template) - .build(&self.event_loop) - .map_err(|e| Error::SystemTray(Box::new(e)))?; + ); - #[cfg(not(target_os = "macos"))] - let tray = SystemTrayBuilder::new( - icon, - system_tray - .menu - .map(|menu| to_wry_context_menu(&mut items, menu)), - ) - .build(&self.event_loop) - .map_err(|e| Error::SystemTray(Box::new(e)))?; + #[cfg(target_os = "macos")] + { + tray_builder = tray_builder.with_icon_as_template(system_tray.icon_as_template); + } + + let tray = tray_builder + .build(&self.event_loop) + .map_err(|e| Error::SystemTray(Box::new(e)))?; *self.tray_context.items.lock().unwrap() = items; *self.tray_context.tray.lock().unwrap() = Some(Arc::new(Mutex::new(tray))); @@ -2530,7 +2523,9 @@ fn handle_user_message( } TrayMessage::UpdateIcon(icon) => { if let Some(tray) = &*tray_context.tray.lock().unwrap() { - tray.lock().unwrap().set_icon(icon.into_platform_icon()); + if let Ok(icon) = TrayIcon::try_from(icon) { + tray.lock().unwrap().set_icon(icon.0); + } } } #[cfg(target_os = "macos")] diff --git a/core/tauri-runtime-wry/src/system_tray.rs b/core/tauri-runtime-wry/src/system_tray.rs index db16ee0ae..1a5f11c1d 100644 --- a/core/tauri-runtime-wry/src/system_tray.rs +++ b/core/tauri-runtime-wry/src/system_tray.rs @@ -7,7 +7,7 @@ pub use tauri_runtime::{ Menu, MenuEntry, MenuItem, MenuUpdate, Submenu, SystemTrayMenu, SystemTrayMenuEntry, SystemTrayMenuItem, TrayHandle, }, - SystemTrayEvent, TrayIcon, + Icon, SystemTrayEvent, }; pub use wry::application::{ event::TrayEvent, @@ -15,6 +15,7 @@ pub use wry::application::{ menu::{ ContextMenu as WryContextMenu, CustomMenuItem as WryCustomMenuItem, MenuItem as WryMenuItem, }, + system_tray::Icon as WryTrayIcon, }; #[cfg(target_os = "macos")] @@ -35,13 +36,25 @@ pub type SystemTrayEventHandler = Box; pub type SystemTrayEventListeners = Arc>>>; pub type SystemTrayItems = Arc>>; +/// Wrapper around a [`wry::application::system_tray::Icon`] that can be created from an [`WindowIcon`]. +pub struct TrayIcon(pub(crate) WryTrayIcon); + +impl TryFrom for TrayIcon { + type Error = Error; + fn try_from(icon: Icon) -> std::result::Result { + WryTrayIcon::from_rgba(icon.rgba, icon.width, icon.height) + .map(Self) + .map_err(crate::icon_err) + } +} + #[derive(Debug, Clone)] pub struct SystemTrayHandle { pub(crate) proxy: EventLoopProxy>, } impl TrayHandle for SystemTrayHandle { - fn set_icon(&self, icon: TrayIcon) -> Result<()> { + fn set_icon(&self, icon: Icon) -> Result<()> { self .proxy .send_event(Message::Tray(TrayMessage::UpdateIcon(icon))) diff --git a/core/tauri-runtime/src/lib.rs b/core/tauri-runtime/src/lib.rs index f7c36e380..0d02eaab2 100644 --- a/core/tauri-runtime/src/lib.rs +++ b/core/tauri-runtime/src/lib.rs @@ -7,7 +7,7 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] use serde::Deserialize; -use std::{fmt::Debug, path::PathBuf, sync::mpsc::Sender}; +use std::{fmt::Debug, sync::mpsc::Sender}; use tauri_utils::Theme; use uuid::Uuid; @@ -40,7 +40,7 @@ use crate::http::{ #[non_exhaustive] #[derive(Debug, Default)] pub struct SystemTray { - pub icon: Option, + pub icon: Option, pub menu: Option, #[cfg(target_os = "macos")] pub icon_as_template: bool, @@ -59,7 +59,7 @@ impl SystemTray { /// Sets the tray icon. Must be a [`TrayIcon::File`] on Linux and a [`TrayIcon::Raw`] on Windows and macOS. #[must_use] - pub fn with_icon(mut self, icon: TrayIcon) -> Self { + pub fn with_icon(mut self, icon: Icon) -> Self { self.icon.replace(icon); self } @@ -151,7 +151,7 @@ pub type Result = std::result::Result; /// Window icon. #[derive(Debug, Clone)] -pub struct WindowIcon { +pub struct Icon { /// RGBA bytes of the icon. pub rgba: Vec, /// Icon width. @@ -160,42 +160,6 @@ pub struct WindowIcon { pub height: u32, } -/// A icon definition. -#[derive(Debug, Clone)] -#[non_exhaustive] -pub enum TrayIcon { - /// Icon from file path. - File(PathBuf), - /// Icon from raw file bytes. - Raw(Vec), -} - -impl TrayIcon { - /// Converts the icon to a the expected system tray format. - /// We expect the code that passes the Icon enum to have already checked the platform. - #[cfg(target_os = "linux")] - pub fn into_platform_icon(self) -> PathBuf { - match self { - Self::File(path) => path, - Self::Raw(_) => { - panic!("linux requires the system menu icon to be a file path, not raw bytes.") - } - } - } - - /// Converts the icon to a the expected system tray format. - /// We expect the code that passes the Icon enum to have already checked the platform. - #[cfg(not(target_os = "linux"))] - pub fn into_platform_icon(self) -> Vec { - match self { - Self::Raw(r) => r, - Self::File(_) => { - panic!("non-linux system menu icons must be raw bytes, not a file path.") - } - } - } -} - /// A type that can be used as an user event. pub trait UserEvent: Debug + Clone + Send + 'static {} @@ -567,7 +531,7 @@ pub trait Dispatch: Debug + Clone + Send + Sync + Sized + 'static fn set_focus(&self) -> Result<()>; /// Updates the window icon. - fn set_icon(&self, icon: WindowIcon) -> Result<()>; + fn set_icon(&self, icon: Icon) -> Result<()>; /// Whether to show the window icon in the task bar or not. fn set_skip_taskbar(&self, skip: bool) -> Result<()>; diff --git a/core/tauri-runtime/src/menu.rs b/core/tauri-runtime/src/menu.rs index 2dfaa1039..97286567b 100644 --- a/core/tauri-runtime/src/menu.rs +++ b/core/tauri-runtime/src/menu.rs @@ -147,7 +147,7 @@ pub enum MenuUpdate { } pub trait TrayHandle: fmt::Debug + Clone + Send + Sync { - fn set_icon(&self, icon: crate::TrayIcon) -> crate::Result<()>; + fn set_icon(&self, icon: crate::Icon) -> crate::Result<()>; fn set_menu(&self, menu: crate::menu::SystemTrayMenu) -> crate::Result<()>; fn update_item(&self, id: u16, update: MenuUpdate) -> crate::Result<()>; #[cfg(target_os = "macos")] diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 9071172c5..b6524e89b 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -4,7 +4,7 @@ //! Items specific to the [`Runtime`](crate::Runtime)'s webview. -use crate::{menu::Menu, window::DetachedWindow, WindowIcon}; +use crate::{menu::Menu, window::DetachedWindow, Icon}; use tauri_utils::{ config::{WindowConfig, WindowUrl}, @@ -153,7 +153,7 @@ pub trait WindowBuilder: WindowBuilderBase { fn always_on_top(self, always_on_top: bool) -> Self; /// Sets the window icon. - fn icon(self, icon: WindowIcon) -> crate::Result; + fn icon(self, icon: Icon) -> crate::Result; /// Sets whether or not the window icon should be added to the taskbar. #[must_use] diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 7b70768ca..0ee7af3ed 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -47,7 +47,7 @@ use crate::runtime::menu::{Menu, MenuId, MenuIdRef}; use crate::runtime::RuntimeHandle; #[cfg(feature = "system-tray")] -use crate::runtime::{SystemTrayEvent as RuntimeSystemTrayEvent, TrayIcon}; +use crate::runtime::SystemTrayEvent as RuntimeSystemTrayEvent; #[cfg(updater)] use crate::updater; @@ -1234,31 +1234,7 @@ impl Builder { #[allow(clippy::type_complexity)] pub fn build(mut self, context: Context) -> crate::Result> { #[cfg(feature = "system-tray")] - let system_tray_icon = { - let icon = context.system_tray_icon.clone(); - - // check the icon format if the system tray is configured - if self.system_tray.is_some() { - use std::io::{Error, ErrorKind}; - #[cfg(target_os = "linux")] - if let Some(TrayIcon::Raw(..)) = icon { - return Err(crate::Error::InvalidIcon(Error::new( - ErrorKind::InvalidInput, - "system tray icons on linux must be a file path", - ))); - } - - #[cfg(not(target_os = "linux"))] - if let Some(TrayIcon::File(_)) = icon { - return Err(crate::Error::InvalidIcon(Error::new( - ErrorKind::InvalidInput, - "system tray icons on non-linux platforms must be the raw bytes", - ))); - } - } - - icon - }; + let system_tray_icon = context.system_tray_icon.clone(); #[cfg(all(feature = "system-tray", target_os = "macos"))] let system_tray_icon_as_template = context @@ -1391,12 +1367,15 @@ impl Builder { if let Some(menu) = system_tray.menu() { tray::get_menu_ids(&mut ids, menu); } - let mut tray = tray::SystemTray::new().with_icon( - system_tray - .icon - .or(system_tray_icon) - .expect("tray icon not found; please configure it on tauri.conf.json"), - ); + let tray_icon = if let Some(icon) = system_tray.icon { + Some(icon) + } else if let Some(tray_icon) = system_tray_icon { + Some(tray_icon.try_into()?) + } else { + None + }; + let mut tray = tray::SystemTray::new() + .with_icon(tray_icon.expect("tray icon not found; please configure it on tauri.conf.json")); if let Some(menu) = system_tray.menu { tray = tray.with_menu(menu); } diff --git a/core/tauri/src/app/tray.rs b/core/tauri/src/app/tray.rs index 41beb0b0c..b9d3176bf 100644 --- a/core/tauri/src/app/tray.rs +++ b/core/tauri/src/app/tray.rs @@ -8,9 +8,9 @@ pub use crate::{ MenuHash, MenuId, MenuIdRef, MenuUpdate, SystemTrayMenu, SystemTrayMenuEntry, TrayHandle, }, window::dpi::{PhysicalPosition, PhysicalSize}, - SystemTray, TrayIcon, + SystemTray, }, - Runtime, + Icon, Runtime, }; use tauri_macros::default_runtime; @@ -132,9 +132,9 @@ impl SystemTrayHandle { panic!("item id not found") } - /// Updates the tray icon. Must be a [`TrayIcon::File`] on Linux and a [`TrayIcon::Raw`] on Windows and macOS. - pub fn set_icon(&self, icon: TrayIcon) -> crate::Result<()> { - self.inner.set_icon(icon).map_err(Into::into) + /// Updates the tray icon. + pub fn set_icon(&self, icon: Icon) -> crate::Result<()> { + self.inner.set_icon(icon.try_into()?).map_err(Into::into) } /// Updates the tray menu. diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 40de769ad..974c8f5b1 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -231,7 +231,7 @@ pub use { dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Pixel, Position, Size}, CursorIcon, FileDropEvent, }, - RunIteration, TrayIcon, UserAttentionType, + RunIteration, UserAttentionType, }, self::state::{State, StateManager}, self::utils::{ @@ -372,7 +372,7 @@ pub enum Icon { }, } -impl TryFrom for runtime::WindowIcon { +impl TryFrom for runtime::Icon { type Error = Error; fn try_from(icon: Icon) -> Result { @@ -445,7 +445,7 @@ pub struct Context { pub(crate) config: Config, pub(crate) assets: Arc, pub(crate) default_window_icon: Option, - pub(crate) system_tray_icon: Option, + pub(crate) system_tray_icon: Option, pub(crate) package_info: PackageInfo, pub(crate) _info_plist: (), pub(crate) pattern: Pattern, @@ -506,13 +506,13 @@ impl Context { /// The icon to use on the system tray UI. #[inline(always)] - pub fn system_tray_icon(&self) -> Option<&TrayIcon> { + pub fn system_tray_icon(&self) -> Option<&Icon> { self.system_tray_icon.as_ref() } /// A mutable reference to the icon to use on the system tray UI. #[inline(always)] - pub fn system_tray_icon_mut(&mut self) -> &mut Option { + pub fn system_tray_icon_mut(&mut self) -> &mut Option { &mut self.system_tray_icon } @@ -548,7 +548,7 @@ impl Context { config: Config, assets: Arc, default_window_icon: Option, - system_tray_icon: Option, + system_tray_icon: Option, package_info: PackageInfo, info_plist: (), pattern: Pattern, diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 6088ae4b0..207539655 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -12,13 +12,13 @@ use tauri_runtime::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, CursorIcon, DetachedWindow, MenuEvent, PendingWindow, WindowEvent, }, - Dispatch, EventLoopProxy, Result, RunEvent, Runtime, RuntimeHandle, UserAttentionType, UserEvent, - WindowIcon, + Dispatch, EventLoopProxy, Icon, Result, RunEvent, Runtime, RuntimeHandle, UserAttentionType, + UserEvent, }; #[cfg(feature = "system-tray")] use tauri_runtime::{ menu::{SystemTrayMenu, TrayHandle}, - SystemTray, SystemTrayEvent, TrayIcon, + SystemTray, SystemTrayEvent, }; use tauri_utils::{config::WindowConfig, Theme}; use uuid::Uuid; @@ -229,7 +229,7 @@ impl WindowBuilder for MockWindowBuilder { self } - fn icon(self, icon: WindowIcon) -> Result { + fn icon(self, icon: Icon) -> Result { Ok(self) } @@ -475,7 +475,7 @@ impl Dispatch for MockDispatcher { Ok(()) } - fn set_icon(&self, icon: WindowIcon) -> Result<()> { + fn set_icon(&self, icon: Icon) -> Result<()> { Ok(()) } @@ -520,7 +520,7 @@ pub struct MockTrayHandler { #[cfg(feature = "system-tray")] impl TrayHandle for MockTrayHandler { - fn set_icon(&self, icon: TrayIcon) -> Result<()> { + fn set_icon(&self, icon: Icon) -> Result<()> { Ok(()) } fn set_menu(&self, menu: SystemTrayMenu) -> Result<()> { diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index ca0deb3a1..5140be727 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -597,7 +597,7 @@ impl PlatformWebview { #[cfg(target_os = "macos")] #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] pub fn inner(&self) -> cocoa::base::id { - self.0.webview.clone() + self.0.webview } /// Returns WKWebView [controller] handle. @@ -606,7 +606,7 @@ impl PlatformWebview { #[cfg(target_os = "macos")] #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] pub fn controller(&self) -> cocoa::base::id { - self.0.manager.clone() + self.0.manager } /// Returns [NSWindow] associated with the WKWebView webview. @@ -615,7 +615,7 @@ impl PlatformWebview { #[cfg(target_os = "macos")] #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] pub fn ns_window(&self) -> cocoa::base::id { - self.0.ns_window.clone() + self.0.ns_window } } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 05e5bde39..84e102192 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -229,6 +229,12 @@ version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +[[package]] +name = "bytemuck" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + [[package]] name = "byteorder" version = "1.4.3" @@ -353,9 +359,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.1" +version = "3.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a836566fa5f52f7ddf909a8a2f9029b9f78ca584cd95cf7e87f8073110f4c5c9" +checksum = "1df386a2d0f35bdefc0642fd8bcb2cd28243959f028abfd22fbade6f7d30980e" dependencies = [ "atty", "bitflags", @@ -406,6 +412,12 @@ dependencies = [ "objc", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.4" @@ -1011,13 +1023,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1375,6 +1387,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "image" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "indexmap" version = "1.8.2" @@ -1498,9 +1524,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -1835,6 +1861,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -2405,7 +2442,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2450,7 +2487,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -2991,9 +3028,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2497feadd60f2a5a7f124572d7a44b2aba589a0ad2a65d3aaf2d073c327c3b8" +checksum = "3bfe4c782f0543f667ee3b732d026b2f1c64af39cd52e726dec1ea1f2d8f6b80" dependencies = [ "bitflags", "cairo-rs", @@ -3011,6 +3048,7 @@ dependencies = [ "glib", "glib-sys", "gtk", + "image", "instant", "jni 0.19.0", "lazy_static", @@ -3024,11 +3062,13 @@ dependencies = [ "once_cell", "parking_lot 0.11.2", "paste", + "png 0.17.5", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", + "uuid 0.8.2", "windows 0.37.0", "windows-implement", "x11-dl", @@ -3206,7 +3246,7 @@ dependencies = [ "aes-gcm", "brotli", "ctor", - "getrandom 0.2.6", + "getrandom 0.2.7", "glob", "heck 0.4.0", "html5ever", @@ -3509,9 +3549,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" @@ -3562,6 +3602,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.7", +] [[package]] name = "uuid" @@ -3569,7 +3612,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -3635,12 +3678,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3649,9 +3686,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3659,9 +3696,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", @@ -3674,9 +3711,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ "cfg-if", "js-sys", @@ -3686,9 +3723,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3696,9 +3733,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ "proc-macro2", "quote", @@ -3709,15 +3746,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" dependencies = [ "js-sys", "wasm-bindgen", @@ -4030,9 +4067,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e84a6f7f0ef90004a244a6dd4125b5fb78074b48c4369ab52b3cac68a863e" +checksum = "26b1ba327c7dd4292f46bf8e6ba8e6ec2db4443b2973c9d304a359d95e0aa856" dependencies = [ "block", "cocoa", diff --git a/examples/api/src-tauri/src/main.rs b/examples/api/src-tauri/src/main.rs index 09a9ea04c..15979923f 100644 --- a/examples/api/src-tauri/src/main.rs +++ b/examples/api/src-tauri/src/main.rs @@ -10,8 +10,6 @@ mod cmd; mod menu; -#[cfg(target_os = "linux")] -use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; use serde::Serialize; @@ -129,56 +127,28 @@ fn main() { .build() .unwrap(); } - #[cfg(target_os = "macos")] "icon_1" => { + #[cfg(target_os = "macos")] app.tray_handle().set_icon_as_template(true).unwrap(); app .tray_handle() - .set_icon(tauri::TrayIcon::Raw( + .set_icon(tauri::Icon::Raw( include_bytes!("../../../.icons/tray_icon_with_transparency.png").to_vec(), )) .unwrap(); } - #[cfg(target_os = "macos")] "icon_2" => { + #[cfg(target_os = "macos")] app.tray_handle().set_icon_as_template(true).unwrap(); app .tray_handle() - .set_icon(tauri::TrayIcon::Raw( - include_bytes!("../../../.icons/tray_icon_with_transparency.png").to_vec(), + .set_icon(tauri::Icon::Raw( + include_bytes!("../../../.icons/icon.ico").to_vec(), )) .unwrap(); } - #[cfg(target_os = "linux")] - "icon_1" => app - .tray_handle() - .set_icon(tauri::TrayIcon::File(PathBuf::from( - "../../.icons/tray_icon_with_transparency.png", - ))) - .unwrap(), - #[cfg(target_os = "linux")] - "icon_2" => app - .tray_handle() - .set_icon(tauri::TrayIcon::File(PathBuf::from( - "../../.icons/tray_icon.png", - ))) - .unwrap(), - #[cfg(target_os = "windows")] - "icon_1" => app - .tray_handle() - .set_icon(tauri::TrayIcon::Raw( - include_bytes!("../../../.icons/tray_icon_with_transparency.ico").to_vec(), - )) - .unwrap(), - #[cfg(target_os = "windows")] - "icon_2" => app - .tray_handle() - .set_icon(tauri::TrayIcon::Raw( - include_bytes!("../../../.icons/icon.ico").to_vec(), - )) - .unwrap(), "switch_menu" => { let flag = is_menu1.load(Ordering::Relaxed); app diff --git a/examples/resources/src-tauri/Cargo.lock b/examples/resources/src-tauri/Cargo.lock index c9a3d1841..2931a2b86 100644 --- a/examples/resources/src-tauri/Cargo.lock +++ b/examples/resources/src-tauri/Cargo.lock @@ -140,6 +140,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "bytemuck" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + [[package]] name = "byteorder" version = "1.4.3" @@ -264,6 +270,12 @@ dependencies = [ "objc", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.4" @@ -840,13 +852,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1109,6 +1121,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "image" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "infer" version = "0.7.0" @@ -1403,6 +1429,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1857,7 +1894,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -1902,7 +1939,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -2308,9 +2345,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2497feadd60f2a5a7f124572d7a44b2aba589a0ad2a65d3aaf2d073c327c3b8" +checksum = "3bfe4c782f0543f667ee3b732d026b2f1c64af39cd52e726dec1ea1f2d8f6b80" dependencies = [ "bitflags", "cairo-rs", @@ -2328,6 +2365,7 @@ dependencies = [ "glib", "glib-sys", "gtk", + "image", "instant", "jni 0.19.0", "lazy_static", @@ -2340,11 +2378,13 @@ dependencies = [ "once_cell", "parking_lot 0.11.2", "paste", + "png 0.17.5", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", + "uuid 0.8.2", "windows", "windows-implement", "x11-dl", @@ -2713,9 +2753,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" @@ -2756,6 +2796,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.7", +] [[package]] name = "uuid" @@ -2763,7 +2806,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2815,9 +2858,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webkit2gtk" @@ -3064,9 +3107,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e84a6f7f0ef90004a244a6dd4125b5fb78074b48c4369ab52b3cac68a863e" +checksum = "26b1ba327c7dd4292f46bf8e6ba8e6ec2db4443b2973c9d304a359d95e0aa856" dependencies = [ "block", "cocoa", diff --git a/examples/sidecar/src-tauri/Cargo.lock b/examples/sidecar/src-tauri/Cargo.lock index 186cf3898..1aa9dc60e 100644 --- a/examples/sidecar/src-tauri/Cargo.lock +++ b/examples/sidecar/src-tauri/Cargo.lock @@ -140,6 +140,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "bytemuck" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + [[package]] name = "byteorder" version = "1.4.3" @@ -264,6 +270,12 @@ dependencies = [ "objc", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.4" @@ -840,13 +852,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1109,6 +1121,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "image" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "infer" version = "0.7.0" @@ -1403,6 +1429,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1857,7 +1894,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -1902,7 +1939,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -2308,9 +2345,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2497feadd60f2a5a7f124572d7a44b2aba589a0ad2a65d3aaf2d073c327c3b8" +checksum = "3bfe4c782f0543f667ee3b732d026b2f1c64af39cd52e726dec1ea1f2d8f6b80" dependencies = [ "bitflags", "cairo-rs", @@ -2328,6 +2365,7 @@ dependencies = [ "glib", "glib-sys", "gtk", + "image", "instant", "jni 0.19.0", "lazy_static", @@ -2340,11 +2378,13 @@ dependencies = [ "once_cell", "parking_lot 0.11.2", "paste", + "png 0.17.5", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", + "uuid 0.8.2", "windows", "windows-implement", "x11-dl", @@ -2713,9 +2753,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" @@ -2756,6 +2796,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.7", +] [[package]] name = "uuid" @@ -2763,7 +2806,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2815,9 +2858,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webkit2gtk" @@ -3064,9 +3107,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e84a6f7f0ef90004a244a6dd4125b5fb78074b48c4369ab52b3cac68a863e" +checksum = "26b1ba327c7dd4292f46bf8e6ba8e6ec2db4443b2973c9d304a359d95e0aa856" dependencies = [ "block", "cocoa", diff --git a/examples/tauri-dynamic-lib/src-tauri/Cargo.lock b/examples/tauri-dynamic-lib/src-tauri/Cargo.lock index 612308236..d0e260e87 100644 --- a/examples/tauri-dynamic-lib/src-tauri/Cargo.lock +++ b/examples/tauri-dynamic-lib/src-tauri/Cargo.lock @@ -140,6 +140,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "bytemuck" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + [[package]] name = "byteorder" version = "1.4.3" @@ -264,6 +270,12 @@ dependencies = [ "objc", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.4" @@ -840,13 +852,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1109,6 +1121,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "image" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "infer" version = "0.7.0" @@ -1403,6 +1429,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1847,7 +1884,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -1892,7 +1929,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -2278,9 +2315,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2497feadd60f2a5a7f124572d7a44b2aba589a0ad2a65d3aaf2d073c327c3b8" +checksum = "3bfe4c782f0543f667ee3b732d026b2f1c64af39cd52e726dec1ea1f2d8f6b80" dependencies = [ "bitflags", "cairo-rs", @@ -2298,6 +2335,7 @@ dependencies = [ "glib", "glib-sys", "gtk", + "image", "instant", "jni 0.19.0", "lazy_static", @@ -2310,11 +2348,13 @@ dependencies = [ "once_cell", "parking_lot 0.11.2", "paste", + "png 0.17.5", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", + "uuid 0.8.2", "windows", "windows-implement", "x11-dl", @@ -2689,9 +2729,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" @@ -2732,6 +2772,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.7", +] [[package]] name = "uuid" @@ -2739,7 +2782,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2791,9 +2834,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webkit2gtk" @@ -3040,9 +3083,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e84a6f7f0ef90004a244a6dd4125b5fb78074b48c4369ab52b3cac68a863e" +checksum = "26b1ba327c7dd4292f46bf8e6ba8e6ec2db4443b2973c9d304a359d95e0aa856" dependencies = [ "block", "cocoa", diff --git a/examples/updater/src-tauri/Cargo.lock b/examples/updater/src-tauri/Cargo.lock index a59ef08c5..ca5e8e21c 100644 --- a/examples/updater/src-tauri/Cargo.lock +++ b/examples/updater/src-tauri/Cargo.lock @@ -164,6 +164,12 @@ version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +[[package]] +name = "bytemuck" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" + [[package]] name = "byteorder" version = "1.4.3" @@ -288,6 +294,12 @@ dependencies = [ "objc", ] +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + [[package]] name = "combine" version = "4.6.4" @@ -864,13 +876,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1133,6 +1145,20 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "image" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "infer" version = "0.7.0" @@ -1231,9 +1257,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -1460,6 +1486,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1969,7 +2006,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -2014,7 +2051,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -2469,9 +2506,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2497feadd60f2a5a7f124572d7a44b2aba589a0ad2a65d3aaf2d073c327c3b8" +checksum = "3bfe4c782f0543f667ee3b732d026b2f1c64af39cd52e726dec1ea1f2d8f6b80" dependencies = [ "bitflags", "cairo-rs", @@ -2489,6 +2526,7 @@ dependencies = [ "glib", "glib-sys", "gtk", + "image", "instant", "jni 0.19.0", "lazy_static", @@ -2501,11 +2539,13 @@ dependencies = [ "once_cell", "parking_lot 0.11.2", "paste", + "png 0.17.5", "raw-window-handle", "scopeguard", "serde", "tao-core-video-sys", "unicode-segmentation", + "uuid 0.8.2", "windows", "windows-implement", "x11-dl", @@ -2887,9 +2927,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" @@ -2940,6 +2980,9 @@ name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.7", +] [[package]] name = "uuid" @@ -2947,7 +2990,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -3005,15 +3048,15 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3021,9 +3064,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", @@ -3036,9 +3079,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ "cfg-if", "js-sys", @@ -3048,9 +3091,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3058,9 +3101,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ "proc-macro2", "quote", @@ -3071,15 +3114,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" dependencies = [ "js-sys", "wasm-bindgen", @@ -3336,9 +3379,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e84a6f7f0ef90004a244a6dd4125b5fb78074b48c4369ab52b3cac68a863e" +checksum = "26b1ba327c7dd4292f46bf8e6ba8e6ec2db4443b2973c9d304a359d95e0aa856" dependencies = [ "block", "cocoa", diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 296c17908..e873b0296 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -418,9 +418,6 @@ fn tauri_config_to_bundle_settings( #[cfg(target_os = "linux")] { if let Some(system_tray_config) = &system_tray_config { - let mut icon_path = system_tray_config.icon_path.clone(); - icon_path.set_extension("png"); - resources.push(icon_path.display().to_string()); depends.push("pkg-config".to_string()); let tray = std::env::var("TAURI_TRAY").unwrap_or_else(|_| "ayatana".to_string()); if tray == "ayatana" {