mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: additional macos tray event handling option for menu display (#2958)
This commit is contained in:
@@ -73,6 +73,7 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
||||
let http_port = patch.verge_port;
|
||||
let enable_tray_speed = patch.enable_tray_speed;
|
||||
let enable_global_hotkey = patch.enable_global_hotkey;
|
||||
let tray_event = patch.tray_event;
|
||||
|
||||
let res: std::result::Result<(), anyhow::Error> = {
|
||||
let mut should_restart_core = false;
|
||||
@@ -84,6 +85,7 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
||||
let mut should_update_hotkey = false;
|
||||
let mut should_update_systray_menu = false;
|
||||
let mut should_update_systray_tooltip = false;
|
||||
let mut should_update_systray_click_behavior = false;
|
||||
|
||||
if tun_mode.is_some() {
|
||||
should_update_clash_config = true;
|
||||
@@ -145,6 +147,10 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
||||
should_update_systray_icon = true;
|
||||
}
|
||||
|
||||
if tray_event.is_some() {
|
||||
should_update_systray_click_behavior = true;
|
||||
}
|
||||
|
||||
if should_restart_core {
|
||||
CoreManager::global().restart_core().await?;
|
||||
}
|
||||
@@ -180,6 +186,10 @@ pub async fn patch_verge(patch: IVerge, not_save_file: bool) -> Result<()> {
|
||||
tray::Tray::global().update_tooltip()?;
|
||||
}
|
||||
|
||||
if should_update_systray_click_behavior {
|
||||
tray::Tray::global().update_click_behavior()?;
|
||||
}
|
||||
|
||||
// 处理轻量模式切换
|
||||
if lite_mode.is_some() {
|
||||
if let Some(window) = handle::Handle::global().get_window() {
|
||||
|
||||
Reference in New Issue
Block a user