diff --git a/docs/Menubar-Options.md b/docs/Menubar-Options.md index 364314f..1a69224 100644 --- a/docs/Menubar-Options.md +++ b/docs/Menubar-Options.md @@ -81,6 +81,17 @@ const options = { }; ``` +## Remove Menu from Title Bar + +This option allows removing the `menubar` from `titlebar`. The default value is `false` + +```js +const options = { + // title bar options + removeMenuBar: true +}; +``` + ## Menu Item Color This is the background color of the menu items when the cursor is hovering over each one. It can be a hexadecimal color using `TitlebarColor.fromHex(color)` or a `TitlebarColor`. diff --git a/src/menubar/menubar-options.ts b/src/menubar/menubar-options.ts index 82541e9..b0e90ac 100644 --- a/src/menubar/menubar-options.ts +++ b/src/menubar/menubar-options.ts @@ -46,6 +46,11 @@ export interface MenuBarOptions { * **The default is false** */ onlyShowMenuBar?: boolean; + /** + * Define if MenuBar exists on TitleBar or not. + * **The default is false** + */ + removeMenuBar?: boolean; /** * The color of the svg icons in the menu * **The default is automatic** diff --git a/src/titlebar/index.ts b/src/titlebar/index.ts index c45c74b..83c7b3a 100644 --- a/src/titlebar/index.ts +++ b/src/titlebar/index.ts @@ -47,6 +47,7 @@ export class CustomTitlebar extends ThemeBar { menuTransparency: 0, minimizable: true, onlyShowMenuBar: false, + removeMenuBar: false, shadow: false, titleHorizontalAlignment: 'center', tooltips: { @@ -188,11 +189,14 @@ export class CustomTitlebar extends ThemeBar { ipcRenderer.invoke('request-application-menu')?.then((menu?: Menu) => this.updateMenu(menu)) const menuPosition = this.currentOptions.menuPosition + const removeMenuBar = this.currentOptions.removeMenuBar if (menuPosition) { this.updateMenuPosition(menuPosition) } + if (removeMenuBar) return + append(this.titlebar, this.menuBarContainer) ipcRenderer.send('window-set-minimumSize', this.currentOptions.minWidth, this.currentOptions.minHeight);