feat: Config Tray Click Event

This commit is contained in:
Pylogmon
2023-11-26 18:35:21 +08:00
parent 9d4942723c
commit d8d75b4afa
7 changed files with 42 additions and 7 deletions

View File

@@ -29,8 +29,7 @@ const SettingVerge = ({ onError }: Props) => {
const { t } = useTranslation();
const { verge, patchVerge, mutateVerge } = useVerge();
const { theme_mode, language } = verge ?? {};
const { theme_mode, language, tray_event } = verge ?? {};
const configRef = useRef<DialogRef>(null);
const hotkeyRef = useRef<DialogRef>(null);
const miscRef = useRef<DialogRef>(null);
@@ -91,6 +90,24 @@ const SettingVerge = ({ onError }: Props) => {
</GuardState>
</SettingItem>
{OS !== "linux" && (
<SettingItem label={t("Tray Click Event")}>
<GuardState
value={tray_event ?? "main_window"}
onCatch={onError}
onFormat={(e: any) => e.target.value}
onChange={(e) => onChangeData({ tray_event: e })}
onGuard={(e) => patchVerge({ tray_event: e })}
>
<Select size="small" sx={{ width: 140, "> div": { py: "7.5px" } }}>
<MenuItem value="main_window">{t("Show Main Window")}</MenuItem>
<MenuItem value="system_proxy">{t("System Proxy")}</MenuItem>
<MenuItem value="tun_mode">{t("Tun Mode")}</MenuItem>
</Select>
</GuardState>
</SettingItem>
)}
<SettingItem label={t("Theme Setting")}>
<IconButton
color="inherit"

View File

@@ -85,6 +85,8 @@
"Current System Proxy": "Current System Proxy",
"Theme Mode": "Theme Mode",
"Theme Blur": "Theme Blur",
"Tray Click Event": "Tray Click Event",
"Show Main Window": "Show Main Window",
"Theme Setting": "Theme Setting",
"Layout Setting": "Layout Setting",
"Miscellaneous": "Miscellaneous",

View File

@@ -78,6 +78,8 @@
"Current System Proxy": "Текущий системный прокси",
"Theme Mode": "Режим темы",
"Theme Blur": "Размытие темы",
"Tray Click Event": "Событие щелчка в лотке",
"Show Main Window": "Показать главное окно",
"Theme Setting": "Настройка темы",
"Hotkey Setting": "Настройка клавиатурных сокращений",
"Traffic Graph": "График трафика",

View File

@@ -85,6 +85,8 @@
"Bypass": "当前绕过:",
"Theme Mode": "主题模式",
"Theme Blur": "背景模糊",
"Tray Click Event": "托盘点击事件",
"Show Main Window": "显示主窗口",
"Theme Setting": "主题设置",
"Layout Setting": "界面设置",
"Miscellaneous": "杂项设置",

View File

@@ -155,6 +155,7 @@ interface IProfilesConfig {
interface IVergeConfig {
app_log_level?: "trace" | "debug" | "info" | "warn" | "error" | string;
language?: string;
tray_event?: "main_window" | "system_proxy" | "tun_mode" | string;
clash_core?: string;
theme_mode?: "light" | "dark" | "system";
theme_blur?: boolean;