Update main.js

This commit is contained in:
Anirudh Sevugan 2025-02-27 21:54:49 +05:30 committed by GitHub
parent 872b5cc262
commit 439ef054e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,6 +74,7 @@ const createWindow = (onReadyCallback) => {
contextIsolation: true,
enableRemoteModule: false,
nodeIntegration: false, // Keep this false for security
sandbox: true,
},
});
@ -149,12 +150,20 @@ const setupShortcuts = () => {
});
});
globalShortcut.register('CommandOrControl+Shift+S', () => {
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
if (!focusedWindow) return; // Do nothing if no window is focused
takeSnapshot();
});
globalShortcut.register('CommandOrControl+S', () => {
const focusedWindow = BrowserWindow.getFocusedWindow(); // Get the currently focused window
if (!focusedWindow) return; // Do nothing if no window is focused
takeSnapshot
takeSnapshot();
});
// globalShortcut.register('CommandOrControl+Shift+S', takeSnapshot);
@ -176,8 +185,14 @@ app.whenReady().then(() => {
});
});
app.on("window-all-closed", () => {
app.quit();
/* once bug fixed replace above with:
globalShortcut.unregisterAll();
app.quit();
/* once bug fixed replace above with:
if (process.platform !== 'darwin') app.quit() */
});
app.on("will-quit", () => {
globalShortcut.unregisterAll();
});