mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-07 09:42:07 +08:00
添加win 系统托盘显示代理节点
且gui和托盘刷新机制
This commit is contained in:
@@ -522,3 +522,54 @@ impl Handle {
|
||||
*self.is_exiting.read()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
impl Handle {
|
||||
pub fn set_activation_policy(&self, policy: tauri::ActivationPolicy) -> Result<(), String> {
|
||||
let app_handle = self.app_handle();
|
||||
if let Some(app_handle) = app_handle.as_ref() {
|
||||
app_handle
|
||||
.set_activation_policy(policy)
|
||||
.map_err(|e| e.to_string())
|
||||
} else {
|
||||
Err("AppHandle not initialized".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_activation_policy_regular(&self) {
|
||||
if let Err(e) = self.set_activation_policy(tauri::ActivationPolicy::Regular) {
|
||||
logging!(
|
||||
warn,
|
||||
Type::Setup,
|
||||
true,
|
||||
"Failed to set regular activation policy: {}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_activation_policy_accessory(&self) {
|
||||
if let Err(e) = self.set_activation_policy(tauri::ActivationPolicy::Accessory) {
|
||||
logging!(
|
||||
warn,
|
||||
Type::Setup,
|
||||
true,
|
||||
"Failed to set accessory activation policy: {}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_activation_policy_prohibited(&self) {
|
||||
if let Err(e) = self.set_activation_policy(tauri::ActivationPolicy::Prohibited) {
|
||||
logging!(
|
||||
warn,
|
||||
Type::Setup,
|
||||
true,
|
||||
"Failed to set prohibited activation policy: {}",
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user