mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-27 11:39:31 +08:00
优化代码可读性
This commit is contained in:
parent
e90a30c8a4
commit
5c048c6341
@ -58,6 +58,7 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 显示主窗口
|
||||||
function mainWindowPopUp() {
|
function mainWindowPopUp() {
|
||||||
const currentShow = mainWindow.isVisible() && mainWindow.isFocused();
|
const currentShow = mainWindow.isVisible() && mainWindow.isFocused();
|
||||||
if (currentShow) return mainWindow.hide();
|
if (currentShow) return mainWindow.hide();
|
||||||
@ -80,18 +81,17 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
|
|||||||
globalShortcut.unregisterAll();
|
globalShortcut.unregisterAll();
|
||||||
|
|
||||||
// 注册偏好快捷键
|
// 注册偏好快捷键
|
||||||
// 显示/隐藏快捷键
|
// 处理显示/隐藏快捷键的注册
|
||||||
if (
|
const doublePressShortcuts = ['Ctrl+Ctrl', 'Option+Option', 'Shift+Shift', 'Command+Command'];
|
||||||
['Ctrl+Ctrl', 'Option+Option', 'Shift+Shift', 'Command+Command'].includes(
|
const isDoublePressShortcut = doublePressShortcuts.includes(config.perf.shortCut.showAndHidden);
|
||||||
config.perf.shortCut.showAndHidden
|
|
||||||
)
|
if (isDoublePressShortcut) {
|
||||||
) {
|
// 双击快捷键(如 Ctrl+Ctrl)详见 uIOhookRegister 函数实现
|
||||||
// 双击快捷键,详见 uIOhookRegister
|
|
||||||
} else {
|
} else {
|
||||||
// 普通快捷键,如 Ctrl+Space,F8
|
// 注册普通快捷键(如 Ctrl+Space、F8 等)
|
||||||
globalShortcut.register(config.perf.shortCut.showAndHidden, () =>
|
globalShortcut.register(config.perf.shortCut.showAndHidden, () => {
|
||||||
mainWindowPopUp()
|
mainWindowPopUp();
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 截图快捷键
|
// 截图快捷键
|
||||||
|
Loading…
x
Reference in New Issue
Block a user