Skip to content

Commit da62332

Browse files
committed
Add option to create context-menu only menubar apps
1 parent 04470bc commit da62332

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/MenuBar/MenuBar.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class MenuBar
1818

1919
protected string $label = '';
2020

21+
protected bool $onlyShowContextWindow = false;
22+
2123
protected ?Menu $contextMenu = null;
2224

2325
protected bool $alwaysOnTop = false;
@@ -45,6 +47,13 @@ public function icon(string $icon): self
4547
return $this;
4648
}
4749

50+
public function onlyShowContextMenu(bool $onlyContextMenu = true): self
51+
{
52+
$this->onlyShowContextWindow = $onlyContextMenu;
53+
54+
return $this;
55+
}
56+
4857
public function url(string $url): self
4958
{
5059
$this->url = $url;
@@ -94,6 +103,7 @@ public function toArray(): array
94103
'showDockIcon' => $this->showDockIcon,
95104
'transparency' => $this->transparent,
96105
'backgroundColor' => $this->backgroundColor,
106+
'onlyShowContextWindow' => $this->onlyShowContextWindow,
97107
'contextMenu' => ! is_null($this->contextMenu) ? $this->contextMenu->toArray()['submenu'] : null,
98108
'alwaysOnTop' => $this->alwaysOnTop,
99109
];

0 commit comments

Comments
 (0)