Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(electron): enable native window buttons on frameless
Elian Doran0089346d0485
diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.jsindex 995654f4c2..a0f7f167c8 100644--- a/src/public/app/layouts/desktop_layout.js+++ b/src/public/app/layouts/desktop_layout.js@@ -103,7 +103,6 @@ export default class DesktopLayout {.class("tab-row-container").child(new LeftPaneToggleWidget(true)).child(new TabRowWidget().class("full-width"))- .child(new TitleBarButtonsWidget()).css('height', '40px').css('background-color', 'var(--launcher-pane-background-color)').setParent(appContext)@@ -122,7 +121,6 @@ export default class DesktopLayout {.css("flex-grow", "1").optChild(!launcherPaneIsHorizontal, new FlexContainer('row').child(new TabRowWidget())- .child(new TitleBarButtonsWidget()).css('height', '40px')).child(new FlexContainer('row')diff --git a/src/services/window.ts b/src/services/window.tsindex d0c625a15b..370df0e639 100644--- a/src/services/window.ts+++ b/src/services/window.ts@@ -8,7 +8,7 @@ import sqlInit from "./sql_init.js";import cls from "./cls.js";import keyboardActionsService from "./keyboard_actions.js";import remoteMain from "@electron/remote/main/index.js";-import { App, BrowserWindow, WebContents, ipcMain } from 'electron';+import { App, BrowserWindow, BrowserWindowConstructorOptions, WebContents, ipcMain } from 'electron';import { fileURLToPath } from "url";import { dirname } from "path";@@ -71,6 +71,12 @@ async function createMainWindow(app: App) {const { BrowserWindow } = (await import('electron')); // should not be statically imported+ const extraOpts: Partial<BrowserWindowConstructorOptions> = {};+ if (!optionService.getOptionBool('nativeTitleBarVisible')) {+ extraOpts.titleBarStyle = "hidden";+ extraOpts.titleBarOverlay = (process.platform !== "darwin");+ }+mainWindow = new BrowserWindow({x: mainWindowState.x,y: mainWindowState.y,@@ -82,9 +88,9 @@ async function createMainWindow(app: App) {contextIsolation: false,spellcheck: spellcheckEnabled,webviewTag: true- },- frame: optionService.getOptionBool('nativeTitleBarVisible'),- icon: getIcon()+ },+ icon: getIcon(),+ ...extraOpts});mainWindowState.manage(mainWindow);