feat: menubar icon
This commit is contained in:
parent
febb105682
commit
5320a5846c
|
@ -61,12 +61,10 @@ function createWindow() {
|
|||
} else {
|
||||
win.loadFile(path.join(RENDERER_DIST, "index.html"));
|
||||
}
|
||||
|
||||
createTray();
|
||||
registerGlobalShortcuts();
|
||||
}
|
||||
|
||||
function createTray() {
|
||||
if (tray) tray.destroy()
|
||||
const iconPath = path.join(process.env.VITE_PUBLIC, "AI.png"); // 使用 PNG 图标
|
||||
const icon = nativeImage
|
||||
.createFromPath(iconPath)
|
||||
|
@ -124,6 +122,8 @@ app.on("activate", () => {
|
|||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
createTray();
|
||||
registerGlobalShortcuts();
|
||||
registerIpcMainHandlers(win);
|
||||
|
||||
// 设置 Dock 图标
|
||||
|
@ -137,4 +137,5 @@ app.whenReady().then(() => {
|
|||
// 注销全局快捷键,当应用退出时
|
||||
app.on("will-quit", () => {
|
||||
globalShortcut.unregisterAll();
|
||||
tray?.destroy()
|
||||
});
|
||||
|
|
|
@ -5,16 +5,16 @@ import { MenuBar } from "./MenuBar";
|
|||
const LayoutMain = () => {
|
||||
const platform =
|
||||
document.querySelector("html")?.getAttribute("platform") ?? "macos";
|
||||
|
||||
|
||||
const titleBarStyles =
|
||||
platform === "macos" ? "pl-[5rem] pr-[.5rem]" : "pr-[10rem]";
|
||||
platform === "macos" ? "pl-[5rem] pr-[.5rem]" : "pl-[.5rem]";
|
||||
|
||||
return (
|
||||
<div className="h-full">
|
||||
<div className={`title-bar drag h-[36px] flex`}>
|
||||
<div
|
||||
className={`inline-flex no-drag items-center justify-between ${titleBarStyles}`}
|
||||
>
|
||||
<img src="AI.png" className="h-[24px]" />
|
||||
<MenuBar />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@ export const MenuBar = () => {
|
|||
});
|
||||
|
||||
return () => {
|
||||
window.ipcRenderer.off(EVENT_PARSE_DICOM + ":RES", () => {});
|
||||
window.ipcRenderer.off(EVENT_PARSE_DICOM + ":RES", () => { });
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user