diff --git a/modules/desktop/electron/electron.ts b/modules/desktop/electron/electron.ts index 2339d71..6420d15 100644 --- a/modules/desktop/electron/electron.ts +++ b/modules/desktop/electron/electron.ts @@ -1,5 +1,6 @@ import windowStateManager from "electron-window-state"; import { app, BrowserWindow, ipcMain, net } from "electron"; +import { setupTitlebar, attachTitlebarToWindow } from "custom-electron-titlebar/main"; import * as Sentry from "@sentry/electron"; import contextMenu from "electron-context-menu"; import serve from "electron-serve"; @@ -34,6 +35,8 @@ const port = process.env.PORT || 3000; const allowDebug = !app.isPackaged || process.env.DEBUG_BUILD === "1"; let mainWindow: BrowserWindow | null; +setupTitlebar(); + function createWindow() { const windowState = windowStateManager({ defaultWidth: 800, @@ -41,11 +44,12 @@ function createWindow() { }); const mainWindow = new BrowserWindow({ + titleBarStyle: "hidden", backgroundColor: "black", autoHideMenuBar: true, trafficLightPosition: { - x: 17, - y: 32 + x: 14, + y: 13 }, minHeight: 450, minWidth: 500, @@ -74,6 +78,7 @@ function createWindow() { windowState.saveState(mainWindow); }); + attachTitlebarToWindow(mainWindow); return mainWindow; } diff --git a/modules/desktop/electron/preload.cjs b/modules/desktop/electron/preload.cjs index abb35c2..87f2d15 100644 --- a/modules/desktop/electron/preload.cjs +++ b/modules/desktop/electron/preload.cjs @@ -1,3 +1,5 @@ +import { Titlebar } from "custom-electron-titlebar"; + const isVite = () => { try { return window.location.href.includes("is-vite"); @@ -17,3 +19,10 @@ if (!isVite()) { SvelteSentry.init ); } + +window.addEventListener("DOMContentLoaded", () => { + // Title bar implemenation + new Titlebar({ + titleHorizontalAlignment: "left" + }); +}); diff --git a/modules/desktop/package.json b/modules/desktop/package.json index 6a0d678..4df6391 100644 --- a/modules/desktop/package.json +++ b/modules/desktop/package.json @@ -82,6 +82,7 @@ "axios": "^1.3.2", "bcryptjs": "^2.4.3", "buffer": "^6.0.3", + "custom-electron-titlebar": "4.2.0-beta.0", "dayjs": "^1.11.7", "electron-context-menu": "^3.6.1", "electron-log": "^4.4.8", diff --git a/modules/desktop/src/components/top-bar/top-bar.svelte b/modules/desktop/src/components/top-bar/top-bar.svelte index 929c424..b561666 100644 --- a/modules/desktop/src/components/top-bar/top-bar.svelte +++ b/modules/desktop/src/components/top-bar/top-bar.svelte @@ -21,20 +21,26 @@ }); -
- - tea - - - +
+
+ +
+ {#if $prevPath || $nextPath} +
    + + +
+ {/if} +
+ +