Skip to content

Commit

Permalink
Noot Noot
Browse files Browse the repository at this point in the history
  • Loading branch information
Virej Dasani authored and Virej Dasani committed Aug 16, 2022
1 parent 97f3e72 commit 879f512
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added builds/.DS_Store
Binary file not shown.
24 changes: 15 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require("electron");
const { app, BrowserWindow, globalShortcut } = require("electron");
const path = require("path");

var shortcutPressed = false;

function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
Expand Down Expand Up @@ -56,14 +58,18 @@ app.whenReady().then(() => {
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on("window-all-closed", function () {
if (process.platform !== "darwin") app.quit();
const ret = globalShortcut.register("Alt+Shift+Control+X", () => {
shortcutPressed = true;
app.quit();
});
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
// prevent quitting app except by shortcut
app.on("before-quit", function (event) {
if (!shortcutPressed) {
event.preventDefault();
} else {
app.quit();
}
});

0 comments on commit 879f512

Please sign in to comment.