ai/chat/electron/shortcutManager.js
2024-08-14 14:39:58 +08:00

20 lines
455 B
JavaScript

// shortcutManager.js
const { globalShortcut, BrowserWindow } = require('electron');
let isWindowVisible = true;
function registerShortcuts(mainWindow) {
globalShortcut.register('Ctrl+L', () => {
if (mainWindow && !mainWindow.isFullScreen()) {
if (isWindowVisible) {
mainWindow.hide();
} else {
mainWindow.show();
}
isWindowVisible = !isWindowVisible;
}
});
}
module.exports = { registerShortcuts };