mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 03:32:36 +08:00
chore: try adjusting the triggering of the tray mouse button
This commit is contained in:
parent
424c1f7d8f
commit
e92074e586
|
@ -22,9 +22,29 @@ pub struct Tray {}
|
|||
impl Tray {
|
||||
pub fn update_systray(app_handle: &AppHandle) -> Result<()> {
|
||||
let tray = app_handle.tray_by_id("main").unwrap();
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let _ = tray.set_show_menu_on_left_click(false);
|
||||
|
||||
tray.on_tray_icon_event(|tray, event| {
|
||||
let tray_event = { Config::verge().latest().tray_event.clone() };
|
||||
let tray_event: String = tray_event.unwrap_or("main_window".into());
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Right,
|
||||
..
|
||||
} = event
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
match tray_event.as_str() {
|
||||
"system_proxy" => feat::toggle_system_proxy(),
|
||||
"tun_mode" => feat::toggle_tun_mode(),
|
||||
"main_window" => resolve::create_window(app),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
..
|
||||
|
|
Loading…
Reference in New Issue
Block a user