Skip to content

Commit

Permalink
chore: added localshortcut to use instead of globalshortcut, so we pr…
Browse files Browse the repository at this point in the history
…event registering outside leapp
  • Loading branch information
urz9999 committed May 2, 2022
1 parent 675167c commit c428547
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/desktop-app/electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as path from "path";
import { environment } from "../src/environments/environment";

const { app, BrowserWindow, globalShortcut, ipcMain, Tray, Menu } = require("electron");
const { app, BrowserWindow, ipcMain, Tray, Menu } = require("electron");
const electronLocalshortcut = require('electron-localshortcut');
const { autoUpdater } = require("electron-updater");

const url = require("url");
Expand Down Expand Up @@ -139,17 +140,11 @@ const generateMainWindow = () => {
});

app.on("browser-window-focus", () => {
globalShortcut.register("CommandOrControl+R", () => {
console.log("CommandOrControl+R is pressed: Shortcut Disabled");
});
globalShortcut.register("F5", () => {
console.log("F5 is pressed: Shortcut Disabled");
});
electronLocalshortcut.register(win, ['CommandOrControl+R','CommandOrControl+Shift+R', 'F5'], () => {});
});

app.on("browser-window-blur", () => {
globalShortcut.unregister("CommandOrControl+R");
globalShortcut.unregister("F5");
electronLocalshortcut.unregisterAll(win);
});

remote.enable(win.webContents);
Expand Down

0 comments on commit c428547

Please sign in to comment.