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

Commit

Permalink
Global shortcut for newShot
Browse files Browse the repository at this point in the history
  • Loading branch information
binjospookie authored Feb 1, 2017
1 parent 875d0e2 commit e830bfa
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,30 @@ if (shouldQuit) {
app.on('ready', () => {
tray = new Tray(__dirname + '/icon.png');
createWindow();

const globalShot = globalShortcut.register('CommandOrControl+Alt+M', () => {
if (appFirstStart) {
app.createShot = true;
appWindow.webContents.send('new');
appWindow.setPosition(0,0);
appWindow.show();
appWindow.focus();
appFirstStart = false;
return;
}

dialog.showMessageBox(newShotDialog, function(index) {
// если пользователь подтвердил выбор — далем новый скриншот
if (index === 0) {
app.createShot = true;
appWindow.webContents.send('new');
appWindow.setPosition(0,0);
appWindow.show();
appWindow.focus();
}
})
})

const template = appMenu(app, appWindow);
const menu = Menu.buildFromTemplate(template);

Expand Down

0 comments on commit e830bfa

Please sign in to comment.