Skip to content

Commit

Permalink
Replace global shortcut with a local one (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
josipbagaric authored and kosecki123 committed Sep 14, 2018
1 parent 36da467 commit ff41d1c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions electron-app/main/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, Menu, shell, protocol, globalShortcut } = require('electron');
const { app, BrowserWindow, Menu, shell, protocol } = require('electron');

const path = require('path');
const urlLib = require('url');
Expand Down Expand Up @@ -76,6 +76,10 @@ function createWindow() {
mainWindow = null;
});

mainWindow.reload = () => {
mainWindow.loadURL(MAIN_URL);
};

const HELP_MENU = {
role: 'help',
submenu: [
Expand Down Expand Up @@ -106,6 +110,10 @@ function createWindow() {
{ label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' }
]
},
{
label: 'Window',
submenu: [{ label: 'Reload', accelerator: 'CmdOrCtrl+R', click: mainWindow.reload }]
},
HELP_MENU
];

Expand Down Expand Up @@ -142,13 +150,6 @@ function createWindow() {
event.preventDefault();
}
});

mainWindow.reload = () => {
mainWindow.loadURL(MAIN_URL);
};

globalShortcut.register('F5', mainWindow.reload);
globalShortcut.register('CommandOrControl+R', mainWindow.reload);
}

// This method will be called when Electron has finished
Expand Down

0 comments on commit ff41d1c

Please sign in to comment.