shortcut keys support Win key.

This commit is contained in:
unknown 2024-01-13 09:49:29 +08:00
parent ace6f282d0
commit 90fdc9b8ac

View File

@ -76,13 +76,16 @@ function setShortcutKey(setting: Setting = global.setting) {
setting.general.showHideShortcutKey.trim() !== ""
) {
try {
globalShortcut.register(setting.general.showHideShortcutKey, () => {
globalShortcut.register(
setting.general.showHideShortcutKey.replace("Win", "Super"),
() => {
if (global.mainWindow.isVisible()) {
hideMainWindow();
} else {
showMainWindowBefore(true);
}
});
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
console.log(e);
@ -94,10 +97,13 @@ function setShortcutKey(setting: Setting = global.setting) {
for (const classification of classificationList) {
if (classification.globalShortcutKey && classification.shortcutKey) {
try {
globalShortcut.register(classification.shortcutKey, () => {
globalShortcut.register(
classification.shortcutKey.replace("Win", "Super"),
() => {
// 分类
showMainWindowBefore(true, classification.id);
});
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
console.log(e);
@ -110,10 +116,13 @@ function setShortcutKey(setting: Setting = global.setting) {
for (const item of itemList) {
if (item.globalShortcutKey && item.shortcutKey) {
try {
globalShortcut.register(item.shortcutKey, () => {
globalShortcut.register(
item.shortcutKey.replace("Win", "Super"),
() => {
// 项目
run("main", "open", item);
});
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
console.log(e);
@ -127,7 +136,9 @@ function setShortcutKey(setting: Setting = global.setting) {
setting.quickSearch.showHideShortcutKey.trim() !== ""
) {
try {
globalShortcut.register(setting.quickSearch.showHideShortcutKey, () => {
globalShortcut.register(
setting.quickSearch.showHideShortcutKey.replace("Win", "Super"),
() => {
if (global.setting.quickSearch.enable) {
// 如果窗口不存在或者被销毁的话,就创建窗口
if (
@ -149,7 +160,8 @@ function setShortcutKey(setting: Setting = global.setting) {
}
}
}
});
}
);
} catch (e) {
if (process.env.NODE_ENV === "development") {
console.log(e);