Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Add removeMenuBar option , functionality and docs #255

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/Menubar-Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
5 changes: 5 additions & 0 deletions src/menubar/menubar-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
4 changes: 4 additions & 0 deletions src/titlebar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class CustomTitlebar extends ThemeBar {
menuTransparency: 0,
minimizable: true,
onlyShowMenuBar: false,
removeMenuBar: false,
shadow: false,
titleHorizontalAlignment: 'center',
tooltips: {
Expand Down Expand Up @@ -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);
Expand Down
Loading