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

Commit

Permalink
Add removeMenuBar functionality and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aligjahed committed Mar 20, 2024
1 parent 9995f12 commit a4cce65
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
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 @@ -186,11 +187,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)
}

Expand Down

0 comments on commit a4cce65

Please sign in to comment.