Merge pull request #269 from GizmoTjaz/master

feat: Use the native MacOS window controls
This commit is contained in:
Cas 2023-04-22 22:29:26 +02:00 committed by GitHub
commit 7b3045d973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 20 deletions

View file

@ -122,7 +122,8 @@ function createWindow () {
mainWindow = new BrowserWindow({
width: 1600,
height: 900,
frame: false,
frame: process.platform === 'darwin', // Only keep the native frame on Mac
titleBarStyle: 'hidden',
backgroundColor: '#191c20',
autoHideMenuBar: true,
webPreferences: {

View file

@ -6,27 +6,31 @@
<div class='w-full navbar border-0 bg-dark position-relative p-0'>
<div class='menu-shadow shadow-lg position-absolute w-full h-full z-0' />
<div class='w-full h-full bg-dark z-10 d-flex'>
<div class='d-flex w-full draggable h-full align-items-center'>
<img src='./logo.ico' alt='ico' />
{$title}
<div class='d-flex w-full h-full draggable align-items-center'>
{#if window.version.platform !== 'darwin'}
<img src='./logo.ico' alt='ico' />
{$title}
{/if}
</div>
<div class='controls d-flex h-full pointer'>
<div class='d-flex align-items-center' on:click={() => window.IPC.emit('minimize')}>
<svg viewBox='0 0 24 24'>
<path d='M19 13H5v-2h14v2z' />
</svg>
{#if window.version.platform !== 'darwin'}
<div class='controls d-flex h-full pointer'>
<div class='d-flex align-items-center' on:click={() => window.IPC.emit('minimize')}>
<svg viewBox='0 0 24 24'>
<path d='M19 13H5v-2h14v2z' />
</svg>
</div>
<div class='d-flex align-items-center' on:click={() => window.IPC.emit('maximize')}>
<svg viewBox='0 0 24 24'>
<path d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z' />
</svg>
</div>
<div class='d-flex align-items-center close' on:click={() => window.IPC.emit('close')}>
<svg viewBox='0 0 24 24'>
<path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z' />
</svg>
</div>
</div>
<div class='d-flex align-items-center' on:click={() => window.IPC.emit('maximize')}>
<svg viewBox='0 0 24 24'>
<path d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z' />
</svg>
</div>
<div class='d-flex align-items-center close' on:click={() => window.IPC.emit('close')}>
<svg viewBox='0 0 24 24'>
<path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z' />
</svg>
</div>
</div>
{/if}
</div>
</div>