mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-03 12:20:05 +08:00
fix(tray): wake the main window from Linux tray clicks
Use StatusNotifierItem activation to wake the dashboard, including lightweight mode. Closes #8517
This commit is contained in:
@@ -856,9 +856,14 @@ fn on_tray_icon_event(_tray_icon: &TrayIcon, tray_event: TrayIconEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
const CLICK_STATE: MouseButtonState = if cfg!(target_os = "linux") {
|
||||
MouseButtonState::Up
|
||||
} else {
|
||||
MouseButtonState::Down
|
||||
};
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Down,
|
||||
button_state: CLICK_STATE,
|
||||
..
|
||||
} = tray_event
|
||||
{
|
||||
@@ -868,9 +873,13 @@ fn on_tray_icon_event(_tray_icon: &TrayIcon, tray_event: TrayIconEvent) {
|
||||
}
|
||||
|
||||
AsyncHandler::spawn(|| async move {
|
||||
let verge = Config::verge().await.data_arc();
|
||||
let verge_tray_event = verge.tray_event.clone().unwrap_or_else(|| "main_window".into());
|
||||
let verge_tray_action = TrayAction::from(verge_tray_event.as_str());
|
||||
let configured_event = if cfg!(target_os = "linux") {
|
||||
None
|
||||
} else {
|
||||
Config::verge().await.data_arc().tray_event.clone()
|
||||
};
|
||||
let verge_tray_event = configured_event.as_deref().unwrap_or("main_window");
|
||||
let verge_tray_action = TrayAction::from(verge_tray_event);
|
||||
logging!(debug, Type::Tray, "tray event: {verge_tray_action:?}");
|
||||
match verge_tray_action {
|
||||
TrayAction::SystemProxy => {
|
||||
|
||||
Reference in New Issue
Block a user