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