feat: show current proxy in tray

This commit is contained in:
Memory 2025-11-14 21:58:24 +08:00 committed by GitHub
parent 9a0eb26ef2
commit e1b8c9960a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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'

View File

@ -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",

View File

@ -65,6 +65,7 @@
"settings.floatingWindowCompatModeTooltip": "禁用透明效果以避免在某些 Windows 系统上崩溃,建议保持开启以确保稳定性",
"settings.disableTray": "禁用托盘图标",
"settings.proxyInTray": "在托盘菜单显示代理信息",
"settings.showCurrentProxyInTray": "托盘菜单显示当前代理",
"settings.disableTrayIconColor": "禁用托盘图标颜色变化",
"settings.disableAnimations": "禁用动画效果",
"settings.showTraffic_windows": "在任务栏显示网速",

View File

@ -272,6 +272,7 @@ interface IAppConfig {
originDNS?: string
useWindowFrame: boolean
proxyInTray: boolean
showCurrentProxyInTray: boolean
siderOrder: string[]
siderWidth: number
appTheme: AppTheme