增加标题版本号,系统托盘按钮顺序切换

This commit is contained in:
leizi97
2024-11-03 23:09:13 +08:00
parent 4e4ebf1246
commit 3adf64e251
8 changed files with 14 additions and 17 deletions
+7 -7
View File
@@ -25,11 +25,11 @@ export async function useTray(init: boolean = false, beforExit: Function) {
id: DEFAULT_TRAY_NAME,
menu: await Menu.new({
id: "main",
items: await generateMenuItem(beforExit)
items: await generateMenuItem(beforExit),
}),
action: async e => {
action: async (e) => {
toggleVisibility();
}
},
});
}
} catch (error) {
@@ -43,7 +43,7 @@ export async function useTray(init: boolean = false, beforExit: Function) {
tray.setMenu(
await Menu.new({
id: "main",
items: await generateMenuItem(beforExit)
items: await generateMenuItem(beforExit),
})
);
}
@@ -52,7 +52,7 @@ export async function useTray(init: boolean = false, beforExit: Function) {
}
export async function generateMenuItem(beforExit: Function) {
return [await MenuItemExit("退出", beforExit), await PredefinedMenuItem.new({ item: "Separator" }), await MenuItemShow("显示 / 隐藏")];
return [await MenuItemShow("显示 / 隐藏"), await PredefinedMenuItem.new({ item: "Separator" }), await MenuItemExit("退出", beforExit)];
}
export async function MenuItemExit(text: string, beforExit: Function) {
@@ -64,7 +64,7 @@ export async function MenuItemExit(text: string, beforExit: Function) {
await beforExit();
}
await getCurrentWindow().close();
}
},
});
}
@@ -74,7 +74,7 @@ export async function MenuItemShow(text: string) {
text,
action: async () => {
await toggleVisibility();
}
},
});
}