mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-11-12 20:23:48 +08:00
初始化
This commit is contained in:
19
chat/electron/shortcutManager.js
Normal file
19
chat/electron/shortcutManager.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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 };
|
||||
Reference in New Issue
Block a user