mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-26 20:50:30 +08:00
feat: show current proxy in tray
This commit is contained in:
parent
9a0eb26ef2
commit
e1b8c9960a
@ -39,6 +39,7 @@ export const buildContextMenu = async (): Promise<Menu> => {
|
||||
envType = process.platform === 'win32' ? ['powershell'] : ['bash'],
|
||||
autoCloseConnection,
|
||||
proxyInTray = true,
|
||||
showCurrentProxyInTray = false,
|
||||
triggerSysProxyShortcut = '',
|
||||
showFloatingWindowShortcut = '',
|
||||
showWindowShortcut = '',
|
||||
@ -54,9 +55,11 @@ export const buildContextMenu = async (): Promise<Menu> => {
|
||||
try {
|
||||
const groups = await mihomoGroups()
|
||||
groupsMenu = groups.map((group) => {
|
||||
const groupLabel = showCurrentProxyInTray ? `${group.name} | ${group.now}` : group.name;
|
||||
|
||||
return {
|
||||
id: group.name,
|
||||
label: group.name,
|
||||
label: groupLabel,
|
||||
type: 'submenu',
|
||||
submenu: group.all.map((proxy) => {
|
||||
const delay = proxy.history.length ? proxy.history[proxy.history.length - 1].delay : -1
|
||||
|
||||
@ -49,6 +49,7 @@ const GeneralConfig: React.FC = () => {
|
||||
useDockIcon = true,
|
||||
showTraffic = false,
|
||||
proxyInTray = true,
|
||||
showCurrentProxyInTray = false,
|
||||
disableTray = false,
|
||||
disableTrayIconColor = false,
|
||||
disableAnimations = false,
|
||||
@ -342,6 +343,17 @@ const GeneralConfig: React.FC = () => {
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
{proxyInTray && (
|
||||
<SettingItem title={t('settings.showCurrentProxyInTray')} divider>
|
||||
<Switch
|
||||
size="sm"
|
||||
isSelected={showCurrentProxyInTray}
|
||||
onValueChange={async (v) => {
|
||||
await patchAppConfig({ showCurrentProxyInTray: v })
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
)}
|
||||
<SettingItem
|
||||
title={t('settings.showTraffic', {
|
||||
context: platform === 'win32' ? 'windows' : 'mac'
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
"settings.floatingWindowCompatModeTooltip": "Disables transparency effects to prevent crashes on some Windows systems. Recommended to keep enabled for stability",
|
||||
"settings.disableTray": "Disable Tray Icon",
|
||||
"settings.proxyInTray": "Show Proxy Info in Tray Menu",
|
||||
"settings.showCurrentProxyInTray": "Show Current Proxy in Tray Menu",
|
||||
"settings.disableTrayIconColor": "Disable Tray Icon Color Changes",
|
||||
"settings.disableAnimations": "Disable Animation Effects",
|
||||
"settings.showTraffic_windows": "Show Network Speed in Taskbar",
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
"settings.floatingWindowCompatModeTooltip": "禁用透明效果以避免在某些 Windows 系统上崩溃,建议保持开启以确保稳定性",
|
||||
"settings.disableTray": "禁用托盘图标",
|
||||
"settings.proxyInTray": "在托盘菜单显示代理信息",
|
||||
"settings.showCurrentProxyInTray": "托盘菜单显示当前代理",
|
||||
"settings.disableTrayIconColor": "禁用托盘图标颜色变化",
|
||||
"settings.disableAnimations": "禁用动画效果",
|
||||
"settings.showTraffic_windows": "在任务栏显示网速",
|
||||
|
||||
1
src/shared/types.d.ts
vendored
1
src/shared/types.d.ts
vendored
@ -272,6 +272,7 @@ interface IAppConfig {
|
||||
originDNS?: string
|
||||
useWindowFrame: boolean
|
||||
proxyInTray: boolean
|
||||
showCurrentProxyInTray: boolean
|
||||
siderOrder: string[]
|
||||
siderWidth: number
|
||||
appTheme: AppTheme
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user