mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-17 08:46:38 +08:00
20 lines
455 B
JavaScript
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 };
|