FIX: Close button

This commit is contained in:
Robert Kossessa
2024-02-02 02:08:22 +01:00
parent eedaed9411
commit 47c5a78b5f
2 changed files with 4 additions and 19 deletions

View File

@@ -60,19 +60,17 @@
<div class="flex h-full"> <div class="flex h-full">
<button <button
v-if="resizeable" v-if="resizeable"
class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2" class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2">
@click="window.app.minimize">
<Minus class="h-5 w-5" /> <Minus class="h-5 w-5" />
</button> </button>
<button <button
v-if="resizeable" v-if="resizeable"
class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2" class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2">
@click="window.app.maximize">
<Square class="h-3.5 w-3.5 mr-0.5" /> <Square class="h-3.5 w-3.5 mr-0.5" />
</button> </button>
<button <button
class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2" class="grow flex justify-center items-center app-titlebar-button hover:text-white px-2"
@click="window.app.close"> @click="window.close">
<X class="h-5 w-5 mr-0.5" /> <X class="h-5 w-5 mr-0.5" />
</button> </button>
</div> </div>

View File

@@ -1,7 +1,7 @@
// See the Electron documentation for details on how to use preload scripts: // See the Electron documentation for details on how to use preload scripts:
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts // https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
const { contextBridge, ipcRenderer, BrowserWindow } = require('electron') const { contextBridge, ipcRenderer } = require('electron')
// expose an API to choose available devices // expose an API to choose available devices
@@ -36,16 +36,3 @@ contextBridge.exposeInMainWorld('nanodevice', {
ipcRenderer.on('nano-onvalue', (_event, value) => listener(value)) ipcRenderer.on('nano-onvalue', (_event, value) => listener(value))
}, },
}) })
// expose an API to close the app
contextBridge.exposeInMainWorld('app', {
minimize() {
BrowserWindow.getFocusedWindow()?.minimize()
},
maximize() {
BrowserWindow.getFocusedWindow()?.maximize()
},
close() {
BrowserWindow.getFocusedWindow()?.close()
},
})