Skip to content

Commit

Permalink
feat: optimize hide-main-window-on-startup
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed Aug 6, 2023
1 parent bfb91d4 commit 1d3df32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const isLinux = os.platform() === 'linux'

let urlMode: 'scheme' | 'dev' | 'prod' = 'scheme'
let skipBeforeUnloadCheck = false
let mainWindowIsReady = false

const trayEnabled = !(yargs.argv['disable-tray'])
const backendPort = Number(yargs.argv.port) || config.get('server.port', 3044)
Expand Down Expand Up @@ -234,11 +235,12 @@ const createWindow = () => {
win && win.loadURL(getUrl())
restoreWindowBounds()
win.on('ready-to-show', () => {
if (config.get('hide-main-window-on-startup', false)) {
if (!mainWindowIsReady && config.get('hide-main-window-on-startup', false)) {
hideWindow()
} else {
win!.show()
}
mainWindowIsReady = true
skipBeforeUnloadCheck = false
})

Expand Down

0 comments on commit 1d3df32

Please sign in to comment.