|
@@ -1,10 +1,14 @@
|
|
|
import { join } from "node:path";
|
|
|
-import { BrowserWindow, shell } from "electron";
|
|
|
+import { BrowserWindow, globalShortcut, ipcMain, shell, Notification } from "electron";
|
|
|
import { isLinux, isMac, isWin } from "../utils";
|
|
|
import { destroyTray } from "./trayManage";
|
|
|
import { getStore } from "./storeManage";
|
|
|
import { getIsForceQuit } from "./appManage";
|
|
|
import { registerShortcuts, unregisterShortcuts } from "./shortcutManage";
|
|
|
+interface NotificationData {
|
|
|
+ title: string;
|
|
|
+ body: string;
|
|
|
+}
|
|
|
|
|
|
const url = process.env.VITE_DEV_SERVER_URL;
|
|
|
let mainWindow: BrowserWindow | null = null;
|
|
@@ -52,6 +56,7 @@ export function createMainWindow() {
|
|
|
if (process.env.VITE_DEV_SERVER_URL) {
|
|
|
// Open devTool if the app is not packaged
|
|
|
mainWindow.loadURL(url);
|
|
|
+ // mainWindow.webContents.openDevTools()
|
|
|
} else {
|
|
|
mainWindow.loadFile(global.pathConfig.indexHtml);
|
|
|
}
|
|
@@ -87,6 +92,16 @@ export function createMainWindow() {
|
|
|
mainWindow?.hide();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // globalShortcut.register('CommandOrControl+shift+l', () => {
|
|
|
+ // mainWindow.webContents.openDevTools()
|
|
|
+ // })
|
|
|
+
|
|
|
+ ipcMain.handle('show-notification', (event, { title, body }: NotificationData) => {
|
|
|
+ const notification = new Notification({ title, body });
|
|
|
+ notification.show();
|
|
|
+ });
|
|
|
+
|
|
|
return mainWindow;
|
|
|
}
|
|
|
|