mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 14:10:18 +08:00
fix(tun): make the TUN switch reflect what the Core actually runs
The switch read enable_tun_mode while the Core was given enable_tun_mode && !session_suppression, so falling back to Sidecar left it showing a TUN that was not running, with nothing to write the flag back. Drop the session flag: the stored preference is the only truth, re-checked at startup and written off when the conditions for it are not met, and the switch renders it against current capability.
This commit is contained in:
@@ -63,7 +63,7 @@ pub struct Tray {
|
||||
|
||||
impl TrayState {
|
||||
async fn get_tray_icon(verge: &IVerge) -> (bool, Cow<'_, [u8]>) {
|
||||
let tun_mode = verge.enable_tun_mode.unwrap_or(false);
|
||||
let tun_mode = verge.enable_tun_mode.unwrap_or(false) && crate::core::runstate::RUN_STATE.state().tun_capable();
|
||||
let system_mode = verge.enable_system_proxy.unwrap_or(false);
|
||||
let kind = if tun_mode {
|
||||
IconKind::Tun
|
||||
@@ -284,7 +284,7 @@ impl Tray {
|
||||
|
||||
let verge = Config::verge().await.latest_arc();
|
||||
let system_proxy = verge.enable_system_proxy.unwrap_or(false);
|
||||
let tun_mode = verge.enable_tun_mode.unwrap_or(false);
|
||||
let tun_mode = verge.enable_tun_mode.unwrap_or(false) && crate::core::runstate::RUN_STATE.state().tun_capable();
|
||||
|
||||
let switch_str = |flag: bool| {
|
||||
if flag { "on" } else { "off" }
|
||||
|
||||
Reference in New Issue
Block a user