mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 06:43:44 +08:00
fix: homepage entry lightweight mode exiting Macos tray icon
fix: lightweight mode better handling and logging logic
This commit is contained in:
parent
11b8c8be45
commit
2e38404434
@ -7,6 +7,7 @@
|
|||||||
#### 修复
|
#### 修复
|
||||||
1. **首页**
|
1. **首页**
|
||||||
- 修复 Direct 模式首页无法渲染。
|
- 修复 Direct 模式首页无法渲染。
|
||||||
|
- 修复 首页启用轻量模式导致 ClashVergeRev 从托盘退出。
|
||||||
2. **系统**
|
2. **系统**
|
||||||
- 修复 MacOS 无法使用快捷键粘贴/选择/复制订阅地址。
|
- 修复 MacOS 无法使用快捷键粘贴/选择/复制订阅地址。
|
||||||
|
|
||||||
|
@ -25,18 +25,15 @@ pub fn disable_auto_light_weight_mode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn entry_lightweight_mode() {
|
pub fn entry_lightweight_mode() {
|
||||||
println!("尝试进入轻量模式。motherfucker");
|
|
||||||
if let Some(window) = handle::Handle::global().get_window() {
|
|
||||||
log_err!(window.close());
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(window) = handle::Handle::global().get_window() {
|
if let Some(window) = handle::Handle::global().get_window() {
|
||||||
if let Some(webview) = window.get_webview_window("main") {
|
if let Some(webview) = window.get_webview_window("main") {
|
||||||
log_err!(webview.destroy());
|
let _ = webview.destroy();
|
||||||
|
let _ = window.hide();
|
||||||
println!("[lightweight_mode] 轻量模式已开启");
|
println!("[lightweight_mode] 轻量模式已开启");
|
||||||
log::info!(target: "app", "[lightweight_mode] 轻量模式已开启");
|
log::info!(target: "app", "[lightweight_mode] 轻量模式已开启");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let _ = cancel_light_weight_timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_window_close_listener() -> u32 {
|
fn setup_window_close_listener() -> u32 {
|
||||||
@ -132,10 +129,9 @@ fn cancel_light_weight_timer() -> Result<()> {
|
|||||||
delay_timer
|
delay_timer
|
||||||
.remove_task(task.task_id)
|
.remove_task(task.task_id)
|
||||||
.context("failed to remove light weight timer task")?;
|
.context("failed to remove light weight timer task")?;
|
||||||
|
println!("[lightweight_mode] 轻量模式计时器已取消");
|
||||||
|
log::info!(target: "app", "[lightweight_mode] 轻量模式计时器已取消");
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("[lightweight_mode] 轻量模式计时器已取消");
|
|
||||||
log::info!(target: "app", "[lightweight_mode] 轻量模式计时器已取消");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,9 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
sx={{
|
sx={{
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
color: "primary.main",
|
color: "primary.main",
|
||||||
"&:hover": { textDecoration: "underline" }
|
"&:hover": { textDecoration: "underline" },
|
||||||
}}
|
}}
|
||||||
onClick={() => entry_lightweight_mode()}
|
onClick={async () => await entry_lightweight_mode()}
|
||||||
>
|
>
|
||||||
{t("Enable")}
|
{t("Enable")}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -115,17 +115,25 @@ export const LiteModeViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
slotProps={{
|
slotProps={{
|
||||||
input: {
|
input: {
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">{t("mins")}</InputAdornment>
|
<InputAdornment position="end">
|
||||||
)
|
{t("mins")}
|
||||||
}
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem sx={{ padding: "5px 2px" }}>
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
<Typography variant="body2" color="text.secondary" sx={{ fontStyle: "italic" }}>
|
<Typography
|
||||||
{t("When closing the window, LightWeight Mode will be automatically activated after _n minutes",
|
variant="body2"
|
||||||
{ n: values.autoEnterLiteModeDelay })}
|
color="text.secondary"
|
||||||
|
sx={{ fontStyle: "italic" }}
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
"When closing the window, LightWeight Mode will be automatically activated after _n minutes",
|
||||||
|
{ n: values.autoEnterLiteModeDelay },
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</>
|
</>
|
||||||
|
@ -37,7 +37,11 @@ import { BasePage } from "@/components/base";
|
|||||||
import { ClashInfoCard } from "@/components/home/clash-info-card";
|
import { ClashInfoCard } from "@/components/home/clash-info-card";
|
||||||
import { SystemInfoCard } from "@/components/home/system-info-card";
|
import { SystemInfoCard } from "@/components/home/system-info-card";
|
||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { entry_lightweight_mode, openWebUrl, patchVergeConfig } from "@/services/cmds";
|
import {
|
||||||
|
entry_lightweight_mode,
|
||||||
|
openWebUrl,
|
||||||
|
patchVergeConfig,
|
||||||
|
} from "@/services/cmds";
|
||||||
import { TestCard } from "@/components/home/test-card";
|
import { TestCard } from "@/components/home/test-card";
|
||||||
import { IpInfoCard } from "@/components/home/ip-info-card";
|
import { IpInfoCard } from "@/components/home/ip-info-card";
|
||||||
|
|
||||||
@ -260,7 +264,11 @@ const HomePage = () => {
|
|||||||
header={
|
header={
|
||||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||||
<Tooltip title={t("LightWeight Mode")} arrow>
|
<Tooltip title={t("LightWeight Mode")} arrow>
|
||||||
<IconButton onClick={() => entry_lightweight_mode()} size="small" color="inherit">
|
<IconButton
|
||||||
|
onClick={async () => await entry_lightweight_mode()}
|
||||||
|
size="small"
|
||||||
|
color="inherit"
|
||||||
|
>
|
||||||
<HistoryEduOutlined />
|
<HistoryEduOutlined />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user