diff --git a/common/components/Menubar.svelte b/common/components/Menubar.svelte
index 84671af..f148a1a 100644
--- a/common/components/Menubar.svelte
+++ b/common/components/Menubar.svelte
@@ -13,22 +13,10 @@
const debug = persisted('debug', '', {
serializer: {
- parse: (e) => e,
- stringify: (e) => e
+ parse: e => e,
+ stringify: e => e
}
})
-
- function minimize () {
- window.ipcRenderer.send('minimize')
- }
-
- function maximize () {
- window.ipcRenderer.send('maximize')
- }
-
- function closeapp () {
- window.ipcRenderer.send('closeapp')
- }
-
-
-
+
+
+
+
@@ -64,7 +52,7 @@
--navbar-height: 32px !important;
}
.z-101 {
- z-index: 101 !important;
+ z-index: 101 !important
}
.draggable {
-webkit-app-region: drag;
@@ -74,7 +62,7 @@
}
img {
top: 0;
- -webkit-app-region: no-drag;
+ -webkit-app-region: no-drag
}
svg {
width: 18px;
@@ -90,7 +78,7 @@
height: 0;
}
}
- #window-controls {
+ .window-controls {
display: grid;
grid-template-columns: repeat(3, 46px);
position: absolute;
@@ -98,12 +86,10 @@
right: 0;
height: 100%;
}
-
- #window-controls {
+ .window-controls {
-webkit-app-region: no-drag;
}
-
- #window-controls .button {
+ .window-controls .button {
grid-row: 1 / span 1;
display: flex;
justify-content: center;
@@ -114,24 +100,19 @@
border: none;
color: #ffffff;
}
-
- #window-controls .button {
+ .window-controls .button {
user-select: none;
}
-
- #window-controls .button:hover {
+ .window-controls .button:hover {
background: rgba(24, 24, 28, 0.2);
}
-
- #window-controls .button:active {
+ .window-controls .button:active {
background: rgba(24, 24, 28, 0.4);
}
-
- #close-button:hover {
+ .close-button:hover {
background: #e81123 !important;
}
-
- #close-button:active {
+ .close-button:active {
background: #f1707a !important;
}
.svg-controls {
diff --git a/electron/src/main/app.js b/electron/src/main/app.js
index 9646f82..31b7dc0 100644
--- a/electron/src/main/app.js
+++ b/electron/src/main/app.js
@@ -36,9 +36,7 @@ export default class App {
allowRunningInsecureContent: false,
enableBlinkFeatures: 'FontAccess, AudioVideoTracks',
backgroundThrottling: false,
- preload: join(__dirname, '/preload.js'),
- contextIsolation: true,
- nodeIntegration: false
+ preload: join(__dirname, '/preload.js')
},
icon: join(__dirname, '/logo_filled.png'),
show: false
@@ -62,6 +60,11 @@ export default class App {
this.mainWindow.on('closed', () => this.destroy())
this.webtorrentWindow.on('closed', () => this.destroy())
ipcMain.on('close', () => this.destroy())
+ ipcMain.on('minimize', () => BrowserWindow.getFocusedWindow()?.minimize())
+ ipcMain.on('maximize', () => {
+ const focusedWindow = BrowserWindow.getFocusedWindow()
+ focusedWindow?.isMaximized() ? focusedWindow.unmaximize() : focusedWindow.maximize()
+});
app.on('before-quit', e => {
if (this.destroyed) return
e.preventDefault()
@@ -155,29 +158,4 @@ export default class App {
this.destroyed = true
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 8c439ef..17f795c 100644
--- a/electron/src/preload/preload.js
+++ b/electron/src/preload/preload.js
@@ -29,9 +29,4 @@ 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