mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 06:53:44 +08:00
chore: try adjusting the triggering of the tray mouse button
This commit is contained in:
parent
a38040d0ea
commit
f456004543
@ -22,9 +22,29 @@ pub struct Tray {}
|
|||||||
impl Tray {
|
impl Tray {
|
||||||
pub fn update_systray(app_handle: &AppHandle) -> Result<()> {
|
pub fn update_systray(app_handle: &AppHandle) -> Result<()> {
|
||||||
let tray = app_handle.tray_by_id("main").unwrap();
|
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| {
|
tray.on_tray_icon_event(|tray, event| {
|
||||||
let tray_event = { Config::verge().latest().tray_event.clone() };
|
let tray_event = { Config::verge().latest().tray_event.clone() };
|
||||||
let tray_event: String = tray_event.unwrap_or("main_window".into());
|
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 {
|
if let TrayIconEvent::Click {
|
||||||
button: MouseButton::Left,
|
button: MouseButton::Left,
|
||||||
..
|
..
|
||||||
|
Loading…
x
Reference in New Issue
Block a user