mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-01 20:32:19 +08:00
feat(electron): enable native window buttons on frameless
This commit is contained in:
parent
3a0a6bc388
commit
0089346d04
@ -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')
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user