mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-18 16:30:32 +08:00
fix(tray): correct spelling of 'TrayMenu' in TrayAction enum and usage
This commit is contained in:
parent
b17dd39f31
commit
95281632a1
@ -55,7 +55,7 @@ pub(crate) enum TrayAction {
|
|||||||
SystemProxy,
|
SystemProxy,
|
||||||
TunMode,
|
TunMode,
|
||||||
MainWindow,
|
MainWindow,
|
||||||
TrayMenue,
|
TrayMenu,
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ impl From<&str> for TrayAction {
|
|||||||
"system_proxy" => Self::SystemProxy,
|
"system_proxy" => Self::SystemProxy,
|
||||||
"tun_mode" => Self::TunMode,
|
"tun_mode" => Self::TunMode,
|
||||||
"main_window" => Self::MainWindow,
|
"main_window" => Self::MainWindow,
|
||||||
"tray_menue" => Self::TrayMenue,
|
"tray_menu" => Self::TrayMenu,
|
||||||
_ => Self::Unknown,
|
_ => Self::Unknown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,7 @@ impl Tray {
|
|||||||
.tray_by_id("main")
|
.tray_by_id("main")
|
||||||
.ok_or_else(|| anyhow::anyhow!("Failed to get main tray"))?;
|
.ok_or_else(|| anyhow::anyhow!("Failed to get main tray"))?;
|
||||||
match tray_event {
|
match tray_event {
|
||||||
TrayAction::TrayMenue => tray.set_show_menu_on_left_click(true)?,
|
TrayAction::TrayMenu => tray.set_show_menu_on_left_click(true)?,
|
||||||
_ => tray.set_show_menu_on_left_click(false)?,
|
_ => tray.set_show_menu_on_left_click(false)?,
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -418,6 +418,9 @@ impl Tray {
|
|||||||
let tray_action = TrayAction::from(tray_event.as_str());
|
let tray_action = TrayAction::from(tray_event.as_str());
|
||||||
|
|
||||||
tray.on_tray_icon_event(move |_app_handle, event| {
|
tray.on_tray_icon_event(move |_app_handle, event| {
|
||||||
|
if matches!(tray_action, TrayAction::Unknown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if let TrayIconEvent::Click {
|
if let TrayIconEvent::Click {
|
||||||
button: MouseButton::Left,
|
button: MouseButton::Left,
|
||||||
button_state: MouseButtonState::Down,
|
button_state: MouseButtonState::Down,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user