屏蔽多余菜单按钮,更改托盘按钮顺序
This commit is contained in:
101
src-tauri/Cargo.lock
generated
101
src-tauri/Cargo.lock
generated
@@ -42,17 +42,14 @@ checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
|
|||||||
name = "app"
|
name = "app"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cocoa 0.24.1 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"home",
|
"home",
|
||||||
"image",
|
"image",
|
||||||
"objc",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
"tauri-plugin-window-state",
|
"tauri-plugin-window-state",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"webkit2gtk",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -269,24 +266,9 @@ checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"cocoa-foundation 0.1.0",
|
"cocoa-foundation",
|
||||||
"core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation",
|
||||||
"core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics",
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
"objc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cocoa"
|
|
||||||
version = "0.24.1"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"block",
|
|
||||||
"cocoa-foundation 0.1.1",
|
|
||||||
"core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"core-graphics 0.22.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
"objc",
|
"objc",
|
||||||
@@ -300,22 +282,8 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation",
|
||||||
"core-graphics-types 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics-types",
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
"objc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cocoa-foundation"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"block",
|
|
||||||
"core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"core-graphics-types 0.1.1 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
"objc",
|
"objc",
|
||||||
@@ -349,16 +317,7 @@ version = "0.9.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation-sys",
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation"
|
|
||||||
version = "0.9.3"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys 0.8.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -368,11 +327,6 @@ version = "0.8.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.8.3"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-graphics"
|
name = "core-graphics"
|
||||||
version = "0.22.3"
|
version = "0.22.3"
|
||||||
@@ -380,20 +334,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation",
|
||||||
"core-graphics-types 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics-types",
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-graphics"
|
|
||||||
version = "0.22.3"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"core-graphics-types 0.1.1 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -405,18 +347,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation",
|
||||||
"foreign-types",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-graphics-types"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)",
|
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -2589,9 +2520,9 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
"cairo-rs",
|
"cairo-rs",
|
||||||
"cc",
|
"cc",
|
||||||
"cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa",
|
||||||
"core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-foundation",
|
||||||
"core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"dispatch",
|
"dispatch",
|
||||||
@@ -2646,7 +2577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679"
|
checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa",
|
||||||
"dirs-next",
|
"dirs-next",
|
||||||
"embed_plist",
|
"embed_plist",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
@@ -2776,7 +2707,7 @@ version = "0.12.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "36b1c5764a41a13176a4599b5b7bd0881bea7d94dfe45e1e755f789b98317e30"
|
checksum = "36b1c5764a41a13176a4599b5b7bd0881bea7d94dfe45e1e755f789b98317e30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa",
|
||||||
"gtk",
|
"gtk",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
@@ -3479,8 +3410,8 @@ checksum = "4c1ad8e2424f554cc5bdebe8aa374ef5b433feff817aebabca0389961fc7ef98"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"block",
|
"block",
|
||||||
"cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cocoa",
|
||||||
"core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"core-graphics",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dunce",
|
"dunce",
|
||||||
"gdk",
|
"gdk",
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ tauri-plugin-window-state = { git = "https://github.com/tauri-apps/tauri-plugin-
|
|||||||
# webbrowser = "0.8.2"
|
# webbrowser = "0.8.2"
|
||||||
# wry = "0.23.4"
|
# wry = "0.23.4"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
# [target.'cfg(target_os = "linux")'.dependencies]
|
||||||
webkit2gtk = "0.18.0"
|
# webkit2gtk = "0.18.0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
# [target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc = "0.2.7"
|
# objc = "0.2.7"
|
||||||
cocoa = {git = "https://github.com/servo/core-foundation-rs/"}
|
# cocoa = {git = "https://github.com/servo/core-foundation-rs/"}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"macos": true,
|
"macos": true,
|
||||||
"linux": false,
|
"linux": true,
|
||||||
"windows": false
|
"windows": false
|
||||||
},
|
},
|
||||||
"system_tray": {
|
"system_tray": {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use tauri::MenuItem;
|
use tauri::MenuItem;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
// #[cfg(target_os = "macos")]
|
||||||
#[macro_use]
|
// #[macro_use]
|
||||||
extern crate objc;
|
// extern crate objc;
|
||||||
|
|
||||||
use tauri::{
|
use tauri::{
|
||||||
window::PlatformWebview, App, Config, CustomMenuItem, Manager, Menu, Submenu, SystemTray,
|
App, Config, CustomMenuItem, Manager, Menu, Submenu, SystemTray, SystemTrayEvent,
|
||||||
SystemTrayEvent, SystemTrayMenu, Window, WindowBuilder, WindowMenuEvent, WindowUrl,
|
SystemTrayMenu, Window, WindowBuilder, WindowMenuEvent, WindowUrl,
|
||||||
};
|
};
|
||||||
mod pake;
|
mod pake;
|
||||||
use pake::PakeConfig;
|
use pake::PakeConfig;
|
||||||
@@ -47,19 +47,19 @@ pub fn get_menu() -> Menu {
|
|||||||
// let previous = CustomMenuItem::new("previous", "Previous (←)");
|
// let previous = CustomMenuItem::new("previous", "Previous (←)");
|
||||||
// let next = CustomMenuItem::new("next", "next (→)");
|
// let next = CustomMenuItem::new("next", "next (→)");
|
||||||
// let refresh = CustomMenuItem::new("refresh", "Refresh");
|
// let refresh = CustomMenuItem::new("refresh", "Refresh");
|
||||||
let zoom_out = CustomMenuItem::new("zoom_out", "Zoom Out (125%)");
|
// let zoom_out = CustomMenuItem::new("zoom_out", "Zoom Out (125%)");
|
||||||
let zoom_in = CustomMenuItem::new("zoom_in", "Zoom In (75%)");
|
// let zoom_in = CustomMenuItem::new("zoom_in", "Zoom In (75%)");
|
||||||
let zoom_reset = CustomMenuItem::new("reset", "Zoom Reset");
|
// let zoom_reset = CustomMenuItem::new("reset", "Zoom Reset");
|
||||||
let hot_key = Menu::new()
|
// let hot_key = Menu::new()
|
||||||
// .add_item(top)
|
// .add_item(top)
|
||||||
// .add_item(buttom)
|
// .add_item(buttom)
|
||||||
// .add_item(previous)
|
// .add_item(previous)
|
||||||
// .add_item(next)
|
// .add_item(next)
|
||||||
// .add_item(refresh)
|
// .add_item(refresh)
|
||||||
.add_item(zoom_in)
|
// .add_item(zoom_in)
|
||||||
.add_item(zoom_out)
|
// .add_item(zoom_out)
|
||||||
.add_item(zoom_reset);
|
// .add_item(zoom_reset);
|
||||||
let hot_key_menu = Submenu::new("Hot Key", hot_key);
|
// let hot_key_menu = Submenu::new("Hot Key", hot_key);
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
// let instructions = CustomMenuItem::new("instruction", "Instruction");
|
// let instructions = CustomMenuItem::new("instruction", "Instruction");
|
||||||
@@ -68,47 +68,46 @@ pub fn get_menu() -> Menu {
|
|||||||
// .add_item(instructions)
|
// .add_item(instructions)
|
||||||
// .add_item(about);
|
// .add_item(about);
|
||||||
// let help_menu = Submenu::new("Help", help);
|
// let help_menu = Submenu::new("Help", help);
|
||||||
Menu::new()
|
Menu::new().add_submenu(first_menu)
|
||||||
.add_submenu(first_menu)
|
// .add_submenu(hot_key_menu)
|
||||||
.add_submenu(hot_key_menu)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_zoom(webview: PlatformWebview, zoom_value: f64) {
|
// pub fn set_zoom(webview: PlatformWebview, zoom_value: f64) {
|
||||||
#[cfg(target_os = "linux")]
|
// #[cfg(target_os = "linux")]
|
||||||
{
|
// {
|
||||||
// see https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/struct.WebView.html
|
// // see https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/struct.WebView.html
|
||||||
// and https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/trait.WebViewExt.html
|
// // and https://docs.rs/webkit2gtk/0.18.2/webkit2gtk/trait.WebViewExt.html
|
||||||
use webkit2gtk::traits::WebViewExt;
|
// use webkit2gtk::traits::WebViewExt;
|
||||||
webview.inner().set_zoom_level(zoom_value);
|
// webview.inner().set_zoom_level(zoom_value);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[cfg(windows)]
|
// #[cfg(windows)]
|
||||||
unsafe {
|
// unsafe {
|
||||||
// see https://docs.rs/webview2-com/0.19.1/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
|
// // see https://docs.rs/webview2-com/0.19.1/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
|
||||||
webview.controller().SetZoomFactor(zoom_value).unwrap();
|
// webview.controller().SetZoomFactor(zoom_value).unwrap();
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
// #[cfg(target_os = "macos")]
|
||||||
unsafe {
|
// unsafe {
|
||||||
let () = msg_send![webview.inner(), setPageZoom: zoom_value];
|
// let () = msg_send![webview.inner(), setPageZoom: zoom_value];
|
||||||
let () = msg_send![webview.controller(), removeAllUserScripts];
|
// let () = msg_send![webview.controller(), removeAllUserScripts];
|
||||||
let bg_color: cocoa::base::id =
|
// let bg_color: cocoa::base::id =
|
||||||
msg_send![class!(NSColor), colorWithDeviceRed:0.5 green:0.2 blue:0.4 alpha:1.];
|
// msg_send![class!(NSColor), colorWithDeviceRed:0.5 green:0.2 blue:0.4 alpha:1.];
|
||||||
let () = msg_send![webview.ns_window(), setBackgroundColor: bg_color];
|
// let () = msg_send![webview.ns_window(), setBackgroundColor: bg_color];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
pub fn set_zoom_out(webview: PlatformWebview) {
|
// pub fn set_zoom_out(webview: PlatformWebview) {
|
||||||
set_zoom(webview, 1.25);
|
// set_zoom(webview, 1.25);
|
||||||
}
|
// }
|
||||||
|
|
||||||
pub fn set_zoom_in(webview: PlatformWebview) {
|
// pub fn set_zoom_in(webview: PlatformWebview) {
|
||||||
set_zoom(webview, 0.75);
|
// set_zoom(webview, 0.75);
|
||||||
}
|
// }
|
||||||
|
|
||||||
pub fn zoom_reset(webview: PlatformWebview) {
|
// pub fn zoom_reset(webview: PlatformWebview) {
|
||||||
set_zoom(webview, 1.0);
|
// set_zoom(webview, 1.0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
pub fn menu_event_handle(event: WindowMenuEvent) {
|
pub fn menu_event_handle(event: WindowMenuEvent) {
|
||||||
match event.menu_item_id() {
|
match event.menu_item_id() {
|
||||||
@@ -116,24 +115,24 @@ pub fn menu_event_handle(event: WindowMenuEvent) {
|
|||||||
"show" => event.window().show().expect("can't show window"),
|
"show" => event.window().show().expect("can't show window"),
|
||||||
"close" => event.window().close().expect("can't close window"),
|
"close" => event.window().close().expect("can't close window"),
|
||||||
"quit" => std::process::exit(0),
|
"quit" => std::process::exit(0),
|
||||||
"zoom_out" => {
|
// "zoom_out" => {
|
||||||
event
|
// event
|
||||||
.window()
|
// .window()
|
||||||
.with_webview(set_zoom_out)
|
// .with_webview(set_zoom_out)
|
||||||
.expect("can't set zoom out");
|
// .expect("can't set zoom out");
|
||||||
}
|
// }
|
||||||
"zoom_in" => {
|
// "zoom_in" => {
|
||||||
event
|
// event
|
||||||
.window()
|
// .window()
|
||||||
.with_webview(set_zoom_in)
|
// .with_webview(set_zoom_in)
|
||||||
.expect("can't set zoom in");
|
// .expect("can't set zoom in");
|
||||||
}
|
// }
|
||||||
"reset" => {
|
// "reset" => {
|
||||||
event
|
// event
|
||||||
.window()
|
// .window()
|
||||||
.with_webview(zoom_reset)
|
// .with_webview(zoom_reset)
|
||||||
.expect("can't reset zoom");
|
// .expect("can't reset zoom");
|
||||||
}
|
// }
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,17 +153,18 @@ pub fn get_system_tray(show_menu: bool) -> SystemTray {
|
|||||||
let show_app = CustomMenuItem::new("show_app".to_string(), "Show App");
|
let show_app = CustomMenuItem::new("show_app".to_string(), "Show App");
|
||||||
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
|
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
|
||||||
let about = CustomMenuItem::new("about".to_string(), "About");
|
let about = CustomMenuItem::new("about".to_string(), "About");
|
||||||
let tray_menu = SystemTrayMenu::new()
|
let tray_menu = SystemTrayMenu::new().add_item(hide_app).add_item(show_app);
|
||||||
.add_item(hide_app)
|
|
||||||
.add_item(show_app)
|
|
||||||
.add_item(quit)
|
|
||||||
.add_item(about);
|
|
||||||
if show_menu {
|
if show_menu {
|
||||||
let hide_menu = CustomMenuItem::new("hide_menu".to_string(), "Hide Menu");
|
let hide_menu = CustomMenuItem::new("hide_menu".to_string(), "Hide Menu");
|
||||||
let show_menu = CustomMenuItem::new("show_menu".to_string(), "Show Menu");
|
let show_menu = CustomMenuItem::new("show_menu".to_string(), "Show Menu");
|
||||||
let tray_menu = tray_menu.add_item(hide_menu).add_item(show_menu);
|
let tray_menu = tray_menu
|
||||||
|
.add_item(hide_menu)
|
||||||
|
.add_item(show_menu)
|
||||||
|
.add_item(quit)
|
||||||
|
.add_item(about);
|
||||||
SystemTray::new().with_menu(tray_menu)
|
SystemTray::new().with_menu(tray_menu)
|
||||||
} else {
|
} else {
|
||||||
|
let tray_menu = tray_menu.add_item(quit).add_item(about);
|
||||||
SystemTray::new().with_menu(tray_menu)
|
SystemTray::new().with_menu(tray_menu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user