Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactoring
- shortcut to easy
- register/unregister shortcut
  • Loading branch information
hirohisa committed Feb 12, 2017
1 parent 4b0b1da commit 33cbd67
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions main.js
Expand Up @@ -29,26 +29,35 @@ function createWindow() {
})
}

function registerShortcut() {
electron.globalShortcut.register('Command+Y', () => {
openDevTools();
});
}

function unregisterShortcut() {
electron.globalShortcut.unregister('Command+Y');
}

function openDevTools() {
win.webContents.openDevTools();
}

require('./main-process/search.js')
require('./main-process/search.js');

function onReady() {
createWindow();
electron.globalShortcut.register('Command+Control+Y', () => {
openDevTools()
});
registerShortcut();
}

// App

app.on('ready', onReady)
app.on('activate', () => {
if (win === null) {
createWindow()
createWindow();
}
})
app.on('will-quit', function() {
unregisterShortcut();
});

0 comments on commit 33cbd67

Please sign in to comment.