Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Fixes issue #69: hides the window on Mac OS using Cmd+H #442

Merged
merged 2 commits into from Dec 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions main.js
Expand Up @@ -189,6 +189,7 @@ function configureReload () {
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
createWindow()
registerShortcuts()

if (process.env.LIVE_RELOAD) {
configureReload()
Expand Down Expand Up @@ -239,5 +240,15 @@ function getScreenshotProtectionLabel () {
return 'Enable screenshot protection (recommended)'
}
}

function registerShortcuts () {
electron.globalShortcut.register('CommandOrControl+H', hideAppOnMac)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the process.platform check (ln 249) be moved up here? Otherwise, users can end up with an unnecessary listener.

If that's the case, then it's probably good to rename the hideAppOnMac to just hideApp.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spresnal Yes it should. Gonna change that ASAP.

}

function hideAppOnMac () {
if (process.platform === 'darwin') {
electron.app.hide()
}
}
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.