+ {#if window.version?.platform !== "darwin"}
+

{/if}
- {#if window.version?.platform === 'linux'}
-
IPC.emit('close')}>
-
{#if $debug}
-
Debug Mode!
+
+ Debug Mode!
+
{/if}
diff --git a/electron/src/main/app.js b/electron/src/main/app.js
index 2252770..e3ffbdc 100644
--- a/electron/src/main/app.js
+++ b/electron/src/main/app.js
@@ -29,11 +29,6 @@ export default class App {
height: 900,
frame: process.platform === 'darwin', // Only keep the native frame on Mac
titleBarStyle: 'hidden',
- titleBarOverlay: {
- color: '#17191c',
- symbolColor: '#eee',
- height: 28
- },
backgroundColor: '#17191c',
autoHideMenuBar: true,
webPreferences: {
@@ -41,7 +36,9 @@ export default class App {
allowRunningInsecureContent: false,
enableBlinkFeatures: 'FontAccess, AudioVideoTracks',
backgroundThrottling: false,
- preload: join(__dirname, '/preload.js')
+ preload: join(__dirname, '/preload.js'),
+ contextIsolation: true,
+ nodeIntegration: false
},
icon: join(__dirname, '/logo_filled.png'),
show: false
@@ -159,3 +156,28 @@ export default class App {
if (!this.updater.install(forceRunAfter)) app.quit()
}
}
+
+ipcMain.on('minimize', (event) => {
+ const focusedWindow = BrowserWindow.getFocusedWindow();
+ if (focusedWindow) {
+ focusedWindow.minimize();
+ }
+});
+
+ipcMain.on('maximize', (event) => {
+ const focusedWindow = BrowserWindow.getFocusedWindow();
+ if (focusedWindow) {
+ if (focusedWindow.isMaximized()) {
+ focusedWindow.unmaximize();
+ } else {
+ focusedWindow.maximize();
+ }
+ }
+});
+
+ipcMain.on('closeapp', (event) => {
+ const focusedWindow = BrowserWindow.getFocusedWindow();
+ if (focusedWindow) {
+ focusedWindow.close();
+ }
+});
\ No newline at end of file
diff --git a/electron/src/preload/preload.js b/electron/src/preload/preload.js
index ba05348..65840db 100644
--- a/electron/src/preload/preload.js
+++ b/electron/src/preload/preload.js
@@ -29,4 +29,9 @@ ipcRenderer.once('port', ({ ports }) => {
ports[0].postMessage(a, b)
}
})
-})
+})
+
+contextBridge.exposeInMainWorld('ipcRenderer', {
+ send: (channel, data) => ipcRenderer.send(channel, data),
+ on: (channel, callback) => ipcRenderer.on(channel, (event, ...args) => callback(...args)),
+});
\ No newline at end of file