system tray icon
This commit is contained in:
17
src-tauri/Cargo.lock
generated
17
src-tauri/Cargo.lock
generated
@@ -1269,6 +1269,7 @@ dependencies = [
|
|||||||
"strum",
|
"strum",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
|
"tauri-macros",
|
||||||
"tauri-plugin-dialog",
|
"tauri-plugin-dialog",
|
||||||
"tauri-plugin-global-shortcut",
|
"tauri-plugin-global-shortcut",
|
||||||
"tauri-plugin-opener",
|
"tauri-plugin-opener",
|
||||||
@@ -1948,9 +1949,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ico"
|
name = "ico"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc50b891e4acf8fe0e71ef88ec43ad82ee07b3810ad09de10f1d01f072ed4b98"
|
checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"png",
|
"png",
|
||||||
@@ -4734,9 +4735,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-codegen"
|
name = "tauri-codegen"
|
||||||
version = "2.5.1"
|
version = "2.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7ef707148f0755110ca54377560ab891d722de4d53297595380a748026f139f"
|
checksum = "d4a24476afd977c5d5d169f72425868613d82747916dd29e0a357c84c4bd6d29"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"brotli",
|
"brotli",
|
||||||
@@ -4761,9 +4762,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-macros"
|
name = "tauri-macros"
|
||||||
version = "2.5.1"
|
version = "2.5.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "71664fd715ee6e382c05345ad258d6d1d50f90cf1b58c0aa726638b33c2a075d"
|
checksum = "d39b349a98dadaffebb73f0a40dcd1f23c999211e5a2e744403db384d0c33de7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -5006,9 +5007,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-utils"
|
name = "tauri-utils"
|
||||||
version = "2.8.0"
|
version = "2.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6b8bbe426abdbf52d050e52ed693130dbd68375b9ad82a3fb17efb4c8d85673"
|
checksum = "219a1f983a2af3653f75b5747f76733b0da7ff03069c7a41901a5eb3ace4557d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"brotli",
|
"brotli",
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ enigo = { version = "0.6.1", features = ["wayland"] }
|
|||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
mlua = { version = "0.11", default-features = false, features = ["lua54", "vendored", "serde", "async"] }
|
mlua = { version = "0.11", default-features = false, features = ["lua54", "vendored", "serde", "async"] }
|
||||||
petpet = "2.4.3"
|
petpet = "2.4.3"
|
||||||
|
tauri-macros = "2.5.5"
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
tauri-plugin-global-shortcut = "2"
|
tauri-plugin-global-shortcut = "2"
|
||||||
tauri-plugin-positioner = "2"
|
tauri-plugin-positioner = "2"
|
||||||
|
|||||||
BIN
src-tauri/icons/icon.tray.png
Normal file
BIN
src-tauri/icons/icon.tray.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 287 B |
@@ -2,11 +2,15 @@ use crate::{
|
|||||||
get_app_handle, lock_r, lock_w, services::app_menu::open_app_menu_window, state::FDOLL,
|
get_app_handle, lock_r, lock_w, services::app_menu::open_app_menu_window, state::FDOLL,
|
||||||
};
|
};
|
||||||
use tauri::{
|
use tauri::{
|
||||||
|
image::Image,
|
||||||
|
include_image,
|
||||||
menu::{Menu, MenuItem},
|
menu::{Menu, MenuItem},
|
||||||
tray::TrayIconBuilder,
|
tray::TrayIconBuilder,
|
||||||
};
|
};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
const TRAY_ICON: Image<'_> = include_image!("./icons/icon.tray.png");
|
||||||
|
|
||||||
/// Constructs app system tray.
|
/// Constructs app system tray.
|
||||||
/// Uses Tauri.
|
/// Uses Tauri.
|
||||||
pub fn init_system_tray() {
|
pub fn init_system_tray() {
|
||||||
@@ -34,7 +38,7 @@ pub fn init_system_tray() {
|
|||||||
error!("menu item {:?} not handled", event.id);
|
error!("menu item {:?} not handled", event.id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.icon(app.default_window_icon().unwrap().clone())
|
.icon(TRAY_ICON)
|
||||||
.build(app)
|
.build(app)
|
||||||
.unwrap_or_else(|err| panic!("Failed to build tray: {}", err));
|
.unwrap_or_else(|err| panic!("Failed to build tray: {}", err));
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user