Skip to content

Commit

Permalink
[Desktop][Windows] Fix undefined app.dock
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolemos committed Dec 28, 2018
1 parent dfd27bc commit f2a8274
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/desktop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const __DEV__ = process.env.NODE_ENV === 'development'
let mainWindow: Electron.BrowserWindow
let tray: Electron.Tray | null = null

const dock: Electron.Dock | null = app.dock || null

// TODO: Persist these and also the window size/position and preferences
let isMenuBarMode = false
let lockOnCenter = true
Expand Down Expand Up @@ -98,7 +100,7 @@ function createWindow() {
})

mainWindow.on('enter-full-screen', () => {
app.dock.show()
if (dock) dock.show()
})

mainWindow.on('leave-full-screen', () => {
Expand Down Expand Up @@ -562,7 +564,7 @@ function updateMenu() {
mainWindow.setTouchBar(touchBar)
}

app.dock.setMenu(Menu.buildFromTemplate(getDockMenuItems()))
if (dock) dock.setMenu(Menu.buildFromTemplate(getDockMenuItems()))
}

function update() {
Expand All @@ -578,9 +580,9 @@ function update() {
updateBrowserWindowOptions()

if (isMenuBarMode) {
app.dock.hide()
if (dock) dock.hide()
} else {
app.dock.show()
if (dock) dock.show()
}
}

Expand Down

0 comments on commit f2a8274

Please sign in to comment.