(feat): migrate bun to pnpm
(feat): some mtp stuff (wip): electron app tray
This commit is contained in:
parent
69149b73bd
commit
82a483d7ab
39 changed files with 10109 additions and 2429 deletions
|
|
@ -15,6 +15,7 @@ import {
|
|||
type DesktopScreenShareAudioOutput,
|
||||
type DesktopScreenShareCapabilities,
|
||||
} from "../shared/ipc.js";
|
||||
import { initTray } from "./tray.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const verbose = process.argv.includes("--verbose");
|
||||
|
|
@ -310,6 +311,7 @@ async function start() {
|
|||
verboseLog("app ready");
|
||||
registerIpc();
|
||||
registerDisplayMediaHandler();
|
||||
initTray();
|
||||
await createWindow();
|
||||
}
|
||||
|
||||
|
|
|
|||
25
apps/electron/src/main/tray.ts
Normal file
25
apps/electron/src/main/tray.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { Tray, Menu } from "electron";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
let tray: Tray | null = null;
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
export function initTray() {
|
||||
const iconPath = path.join(__dirname, "../../build/icons/32x32.png");
|
||||
|
||||
tray = new Tray(iconPath); // keep reference alive
|
||||
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{ label: "Restart", type: "normal" },
|
||||
{ label: "Quit", type: "normal" },
|
||||
]);
|
||||
|
||||
tray.setContextMenu(contextMenu);
|
||||
|
||||
tray.on("click", (event) => {
|
||||
console.log(event);
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue