mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-04 22:56:20 +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")
|
.class("tab-row-container")
|
||||||
.child(new LeftPaneToggleWidget(true))
|
.child(new LeftPaneToggleWidget(true))
|
||||||
.child(new TabRowWidget().class("full-width"))
|
.child(new TabRowWidget().class("full-width"))
|
||||||
.child(new TitleBarButtonsWidget())
|
|
||||||
.css('height', '40px')
|
.css('height', '40px')
|
||||||
.css('background-color', 'var(--launcher-pane-background-color)')
|
.css('background-color', 'var(--launcher-pane-background-color)')
|
||||||
.setParent(appContext)
|
.setParent(appContext)
|
||||||
@ -122,7 +121,6 @@ export default class DesktopLayout {
|
|||||||
.css("flex-grow", "1")
|
.css("flex-grow", "1")
|
||||||
.optChild(!launcherPaneIsHorizontal, new FlexContainer('row')
|
.optChild(!launcherPaneIsHorizontal, new FlexContainer('row')
|
||||||
.child(new TabRowWidget())
|
.child(new TabRowWidget())
|
||||||
.child(new TitleBarButtonsWidget())
|
|
||||||
.css('height', '40px')
|
.css('height', '40px')
|
||||||
)
|
)
|
||||||
.child(new FlexContainer('row')
|
.child(new FlexContainer('row')
|
||||||
|
@ -8,7 +8,7 @@ import sqlInit from "./sql_init.js";
|
|||||||
import cls from "./cls.js";
|
import cls from "./cls.js";
|
||||||
import keyboardActionsService from "./keyboard_actions.js";
|
import keyboardActionsService from "./keyboard_actions.js";
|
||||||
import remoteMain from "@electron/remote/main/index.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 { fileURLToPath } from "url";
|
||||||
import { dirname } from "path";
|
import { dirname } from "path";
|
||||||
@ -71,6 +71,12 @@ async function createMainWindow(app: App) {
|
|||||||
|
|
||||||
const { BrowserWindow } = (await import('electron')); // should not be statically imported
|
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({
|
mainWindow = new BrowserWindow({
|
||||||
x: mainWindowState.x,
|
x: mainWindowState.x,
|
||||||
y: mainWindowState.y,
|
y: mainWindowState.y,
|
||||||
@ -82,9 +88,9 @@ async function createMainWindow(app: App) {
|
|||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
spellcheck: spellcheckEnabled,
|
spellcheck: spellcheckEnabled,
|
||||||
webviewTag: true
|
webviewTag: true
|
||||||
},
|
},
|
||||||
frame: optionService.getOptionBool('nativeTitleBarVisible'),
|
icon: getIcon(),
|
||||||
icon: getIcon()
|
...extraOpts
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindowState.manage(mainWindow);
|
mainWindowState.manage(mainWindow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user