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

Commit

Permalink
Merge pull request #255 from aligjahed/main
Browse files Browse the repository at this point in the history
Add removeMenuBar option , functionality and docs
  • Loading branch information
AlexTorresDev authored May 11, 2024
2 parents bb4eb1b + 8be799e commit 2471c5a
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 @@ -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

0 comments on commit 2471c5a

Please sign in to comment.