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