Skip to content

Commit 03f0459

Browse files
committed
Fix bug "global shortcut F5 overwrite system shurtcus"
1 parent 6cb2ad1 commit 03f0459

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const {
44
BrowserWindow
55
} = require('electron');
66
const shorcuts = require('./shortcuts');
7+
const menu = require('./menu');
78

89
const HOME = 'https://www.figma.com/'
910
const winOptions = {
@@ -34,6 +35,7 @@ app.on('ready', () => {
3435
})
3536

3637
shorcuts(window);
38+
menu(window);
3739

3840
window.on('closed', () => {
3941
window = null;

src/menu.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { Menu, MenuItem } = require('electron');
2+
3+
const menu = new Menu();
4+
5+
module.exports = (window) => {
6+
menu.append(new MenuItem({
7+
label: 'Window',
8+
accelerator: 'F5',
9+
click: () => {
10+
window.reload();
11+
}
12+
}));
13+
14+
Menu.setApplicationMenu(menu);
15+
}

src/shortcuts.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { globalShortcut } = require('electron');
22

3-
module.exports = function(window) {
3+
module.exports = (window) => {
44
let zoom = 0.7;
55

66
globalShortcut.register('CommandOrControl+-', () => {
@@ -19,7 +19,4 @@ module.exports = function(window) {
1919
zoom += 0.05;
2020
window.webContents.setZoomFactor(zoom);
2121
});
22-
globalShortcut.register('F5', () => {
23-
window.reload();
24-
});
2522
}

0 commit comments

Comments
 (0)