mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:53:44 +08:00
fix: MacOS tray click
This commit is contained in:
parent
56efa10f64
commit
dbb8fe15cf
@ -260,7 +260,7 @@ impl Tray {
|
|||||||
map.insert(false, "off");
|
map.insert(false, "off");
|
||||||
map
|
map
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut current_profile_name = "None".to_string();
|
let mut current_profile_name = "None".to_string();
|
||||||
let profiles = Config::profiles();
|
let profiles = Config::profiles();
|
||||||
let profiles = profiles.latest();
|
let profiles = profiles.latest();
|
||||||
@ -284,7 +284,7 @@ impl Tray {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_left_click(app_handle: &AppHandle) {
|
pub fn on_click(app_handle: &AppHandle) {
|
||||||
let tray_event = { Config::verge().latest().tray_event.clone() };
|
let tray_event = { Config::verge().latest().tray_event.clone() };
|
||||||
let tray_event = tray_event.unwrap_or("main_window".into());
|
let tray_event = tray_event.unwrap_or("main_window".into());
|
||||||
match tray_event.as_str() {
|
match tray_event.as_str() {
|
||||||
@ -297,7 +297,10 @@ impl Tray {
|
|||||||
|
|
||||||
pub fn on_system_tray_event(app_handle: &AppHandle, event: SystemTrayEvent) {
|
pub fn on_system_tray_event(app_handle: &AppHandle, event: SystemTrayEvent) {
|
||||||
match event {
|
match event {
|
||||||
SystemTrayEvent::LeftClick { .. } => Tray::on_left_click(app_handle),
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
SystemTrayEvent::LeftClick { .. } => Tray::on_click(app_handle),
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
SystemTrayEvent::RightClick { .. } => Tray::on_click(app_handle),
|
||||||
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
||||||
mode @ ("rule_mode" | "global_mode" | "direct_mode") => {
|
mode @ ("rule_mode" | "global_mode" | "direct_mode") => {
|
||||||
let mode = &mode[0..mode.len() - 5];
|
let mode = &mode[0..mode.len() - 5];
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
"tauri": {
|
"tauri": {
|
||||||
"systemTray": {
|
"systemTray": {
|
||||||
"iconPath": "icons/mac-tray-icon.png",
|
"iconPath": "icons/mac-tray-icon.png",
|
||||||
"iconAsTemplate": true,
|
"iconAsTemplate": true
|
||||||
"menuOnLeftClick": false
|
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
|
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user