mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-09-14 13:56:46 +08:00
Fixed the bug that the quick search window can still be called up by using shortcut keys when quick search is disabled.
This commit is contained in:
parent
e688210a58
commit
5173d73b42
@ -75,6 +75,7 @@ function setShortcutKey(setting: Setting = global.setting) {
|
||||
setting.general.showHideShortcutKey &&
|
||||
setting.general.showHideShortcutKey.trim() !== ""
|
||||
) {
|
||||
try {
|
||||
globalShortcut.register(setting.general.showHideShortcutKey, () => {
|
||||
if (global.mainWindow.isVisible()) {
|
||||
hideMainWindow();
|
||||
@ -82,25 +83,42 @@ function setShortcutKey(setting: Setting = global.setting) {
|
||||
showMainWindowBefore(true);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 分类快捷键
|
||||
let classificationList = selectClassificationList();
|
||||
for (const classification of classificationList) {
|
||||
if (classification.globalShortcutKey && classification.shortcutKey) {
|
||||
try {
|
||||
globalShortcut.register(classification.shortcutKey, () => {
|
||||
// 分类
|
||||
showMainWindowBefore(true, classification.id);
|
||||
});
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 项目快捷键
|
||||
let itemList = selectItemList();
|
||||
for (const item of itemList) {
|
||||
if (item.globalShortcutKey && item.shortcutKey) {
|
||||
try {
|
||||
globalShortcut.register(item.shortcutKey, () => {
|
||||
// 项目
|
||||
run("main", "open", item);
|
||||
});
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 快速搜索
|
||||
@ -108,9 +126,14 @@ function setShortcutKey(setting: Setting = global.setting) {
|
||||
setting.quickSearch.showHideShortcutKey &&
|
||||
setting.quickSearch.showHideShortcutKey.trim() !== ""
|
||||
) {
|
||||
try {
|
||||
globalShortcut.register(setting.quickSearch.showHideShortcutKey, () => {
|
||||
if (global.setting.quickSearch.enable) {
|
||||
// 如果窗口不存在或者被销毁的话,就创建窗口
|
||||
if (!global.quickSearchWindow || global.quickSearchWindow.isDestroyed()) {
|
||||
if (
|
||||
!global.quickSearchWindow ||
|
||||
global.quickSearchWindow.isDestroyed()
|
||||
) {
|
||||
createQuickSearchWindow();
|
||||
}
|
||||
// 如果初始化完毕并且窗口状态是正常的话,可以进行显示/隐藏
|
||||
@ -125,7 +148,13 @@ function setShortcutKey(setting: Setting = global.setting) {
|
||||
showQuickSearchWindowBefore();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user