feature: 可配置 `启动软件时是否打开窗口` (#345)

pull/347/head
王良 3 months ago committed by GitHub
parent c76d0900ca
commit 8351cef2bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -26,6 +26,7 @@ module.exports = {
// 个人远程配置地址
personalUrl: ''
},
startOpenWindow: true, // 启动时是否打开窗口true=打开窗口, false=隐藏窗口
theme: 'dark', // 主题light=亮色, dark=暗色
autoChecked: true, // 是否自动检查更新
skipPreRelease: true, // 是否忽略预发布版本

@ -37,7 +37,11 @@ function setTray () {
// 系统托盘图标目录
label: 'DevTools',
click: () => {
try {
win.webContents.openDevTools()
} catch (e) {
log.error('win.webContents.openDevTools() error:', e)
}
}
},
{
@ -234,17 +238,20 @@ function setDock () {
app.disableHardwareAcceleration() // 禁用gpu
// 开启后是否默认隐藏window
let startHideWindow = false
if (process.argv) {
const args = minimist(process.argv)
if (args.hideWindow) {
let startHideWindow = !DevSidecar.api.config.get().app.startOpenWindow
if (app.getLoginItemSettings().wasOpenedAsHidden) {
startHideWindow = true
}
} else if (process.argv) {
const args = minimist(process.argv)
log.info('start args:', args)
}
if (app.getLoginItemSettings().wasOpenedAsHidden) {
// 通过启动参数,判断是否隐藏窗口
const hideWindowArg = args.hideWindow + ''
if (hideWindowArg === 'true' || hideWindowArg === '1') {
startHideWindow = true
} else if (hideWindowArg === 'false' || hideWindowArg === '0') {
startHideWindow = false
}
}
log.info('start hide window:', startHideWindow, app.getLoginItemSettings())

@ -88,6 +88,19 @@
点击窗口右上角关闭按钮的效果
</div>
</a-form-item>
<a-form-item label="启动时打开窗口" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-radio-group v-model="config.app.startOpenWindow" default-value="true" button-style="solid">
<a-radio-button :value="true">
打开窗口
</a-radio-button>
<a-radio-button :value="false">
隐藏窗口
</a-radio-button>
</a-radio-group>
<div class="form-help">
启动软件时是否打开窗口提示如果设置为隐藏窗口可点击系统托盘小图标打开窗口
</div>
</a-form-item>
<hr/>
<a-form-item label="自动检查更新" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-radio-group v-model="config.app.autoChecked" default-value="light" button-style="solid">

Loading…
Cancel
Save