新增启动参数 `-hidden`,在启动时将软件最小化到系统托盘(#2459)

beta
lyswhut 2025-07-18 22:24:15 +08:00
parent ad0c0f37c9
commit b9abb4ce47
4 changed files with 16 additions and 2 deletions

View File

@ -4,6 +4,7 @@
*默认启用,关闭后将使用系统原生的窗口样式,该设置重启软件后生效*
- 开放API新增播放器声音大小、静音、播放进度控制详情看接入文档#2386
- 新增「设置 → 播放设置 → 调换翻译歌词与罗马音歌词位置」设置,默认关闭(#2451
- 新增启动参数 `-hidden`,在启动时将软件最小化到系统托盘(#2459
### 变更

View File

@ -37,6 +37,11 @@ declare namespace LX {
*/
play?: string
/**
*
*/
hidden?: boolean
[key: string]: boolean | number | string
}

View File

@ -42,8 +42,10 @@ const winEvent = () => {
})
browserWindow.once('ready-to-show', () => {
showWindow()
setThumbarButtons()
if (!global.envParams.cmdParams.hidden) {
showWindow()
setThumbarButtons()
}
global.lx.event_app.main_window_ready_to_show()
})

View File

@ -107,6 +107,11 @@ export const mergeSetting = (originSetting: LX.AppSetting, targetSetting?: Parti
}
}
const applyInitSetting = (setting: LX.AppSetting) => {
if (global.envParams.cmdParams.hidden && !setting['tray.enable']) {
setting['tray.enable'] = true
}
}
export const updateSetting = (setting?: Partial<LX.AppSetting>, isInit: boolean = false) => {
const electronStore_config = getStore(STORE_NAMES.APP_SETTINGS)
@ -114,6 +119,7 @@ export const updateSetting = (setting?: Partial<LX.AppSetting>, isInit: boolean
let originSetting: LX.AppSetting
if (isInit) {
setting &&= migrateSetting(setting)
applyInitSetting(setting as LX.AppSetting)
originSetting = { ...defaultSetting }
} else originSetting = global.lx.appSetting