mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-09 04:16:23 +08:00
🐛 fix:修复Tray菜单唤起热键不更新的问题
This commit is contained in:
parent
cd4036a805
commit
4d621c7521
@ -18,7 +18,13 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
icon = "./icons/icon@2x.png";
|
icon = "./icons/icon@2x.png";
|
||||||
}
|
}
|
||||||
const appIcon = new Tray(path.join(__static, icon));
|
const appIcon = new Tray(path.join(__static, icon));
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
|
||||||
|
const getShowAndHiddenHotKey = (): string => {
|
||||||
|
const config = global.OP_CONFIG.get();
|
||||||
|
return config.perf.shortCut.showAndHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createContextMenu = () => Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: "帮助文档",
|
label: "帮助文档",
|
||||||
click: () => {
|
click: () => {
|
||||||
@ -38,7 +44,7 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{
|
{
|
||||||
label: "显示窗口",
|
label: "显示窗口",
|
||||||
accelerator: "Alt+R",
|
accelerator: getShowAndHiddenHotKey(),
|
||||||
click() {
|
click() {
|
||||||
window.show();
|
window.show();
|
||||||
},
|
},
|
||||||
@ -67,9 +73,10 @@ function createTray(window: BrowserWindow): Promise<Tray> {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
appIcon.on("click", () => {
|
appIcon.on("click", () => {
|
||||||
appIcon.popUpContextMenu(contextMenu);
|
appIcon.setContextMenu(createContextMenu());
|
||||||
|
appIcon.popUpContextMenu();
|
||||||
});
|
});
|
||||||
appIcon.setContextMenu(contextMenu);
|
appIcon.setContextMenu(createContextMenu());
|
||||||
|
|
||||||
resolve(appIcon);
|
resolve(appIcon);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user