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,32 +75,50 @@ function setShortcutKey(setting: Setting = global.setting) {
|
|||||||
setting.general.showHideShortcutKey &&
|
setting.general.showHideShortcutKey &&
|
||||||
setting.general.showHideShortcutKey.trim() !== ""
|
setting.general.showHideShortcutKey.trim() !== ""
|
||||||
) {
|
) {
|
||||||
globalShortcut.register(setting.general.showHideShortcutKey, () => {
|
try {
|
||||||
if (global.mainWindow.isVisible()) {
|
globalShortcut.register(setting.general.showHideShortcutKey, () => {
|
||||||
hideMainWindow();
|
if (global.mainWindow.isVisible()) {
|
||||||
} else {
|
hideMainWindow();
|
||||||
showMainWindowBefore(true);
|
} else {
|
||||||
|
showMainWindowBefore(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
// 分类快捷键
|
// 分类快捷键
|
||||||
let classificationList = selectClassificationList();
|
let classificationList = selectClassificationList();
|
||||||
for (const classification of classificationList) {
|
for (const classification of classificationList) {
|
||||||
if (classification.globalShortcutKey && classification.shortcutKey) {
|
if (classification.globalShortcutKey && classification.shortcutKey) {
|
||||||
globalShortcut.register(classification.shortcutKey, () => {
|
try {
|
||||||
// 分类
|
globalShortcut.register(classification.shortcutKey, () => {
|
||||||
showMainWindowBefore(true, classification.id);
|
// 分类
|
||||||
});
|
showMainWindowBefore(true, classification.id);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 项目快捷键
|
// 项目快捷键
|
||||||
let itemList = selectItemList();
|
let itemList = selectItemList();
|
||||||
for (const item of itemList) {
|
for (const item of itemList) {
|
||||||
if (item.globalShortcutKey && item.shortcutKey) {
|
if (item.globalShortcutKey && item.shortcutKey) {
|
||||||
globalShortcut.register(item.shortcutKey, () => {
|
try {
|
||||||
// 项目
|
globalShortcut.register(item.shortcutKey, () => {
|
||||||
run("main", "open", item);
|
// 项目
|
||||||
});
|
run("main", "open", item);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 快速搜索
|
// 快速搜索
|
||||||
@ -108,24 +126,35 @@ function setShortcutKey(setting: Setting = global.setting) {
|
|||||||
setting.quickSearch.showHideShortcutKey &&
|
setting.quickSearch.showHideShortcutKey &&
|
||||||
setting.quickSearch.showHideShortcutKey.trim() !== ""
|
setting.quickSearch.showHideShortcutKey.trim() !== ""
|
||||||
) {
|
) {
|
||||||
globalShortcut.register(setting.quickSearch.showHideShortcutKey, () => {
|
try {
|
||||||
// 如果窗口不存在或者被销毁的话,就创建窗口
|
globalShortcut.register(setting.quickSearch.showHideShortcutKey, () => {
|
||||||
if (!global.quickSearchWindow || global.quickSearchWindow.isDestroyed()) {
|
if (global.setting.quickSearch.enable) {
|
||||||
createQuickSearchWindow();
|
// 如果窗口不存在或者被销毁的话,就创建窗口
|
||||||
}
|
if (
|
||||||
// 如果初始化完毕并且窗口状态是正常的话,可以进行显示/隐藏
|
!global.quickSearchWindow ||
|
||||||
if (
|
global.quickSearchWindow.isDestroyed()
|
||||||
global.quickSearchWindowInit &&
|
) {
|
||||||
global.quickSearchWindow &&
|
createQuickSearchWindow();
|
||||||
!global.quickSearchWindow.isDestroyed()
|
}
|
||||||
) {
|
// 如果初始化完毕并且窗口状态是正常的话,可以进行显示/隐藏
|
||||||
if (global.quickSearchWindow.isVisible()) {
|
if (
|
||||||
hideQuickSearchWindow();
|
global.quickSearchWindowInit &&
|
||||||
} else {
|
global.quickSearchWindow &&
|
||||||
showQuickSearchWindowBefore();
|
!global.quickSearchWindow.isDestroyed()
|
||||||
|
) {
|
||||||
|
if (global.quickSearchWindow.isVisible()) {
|
||||||
|
hideQuickSearchWindow();
|
||||||
|
} else {
|
||||||
|
showQuickSearchWindowBefore();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user