Skip to content

Commit

Permalink
Support firing a custom event on click
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhamp committed Nov 14, 2024
1 parent 6d531ac commit 8a97895
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/MenuBar/MenuBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class MenuBar

protected bool $alwaysOnTop = false;

protected ?string $event = null;

protected bool $showDockIcon = false;

protected Client $client;
Expand Down Expand Up @@ -95,6 +97,13 @@ public function alwaysOnTop($alwaysOnTop = true): self
return $this;
}

public function event(string $event): self
{
$this->event = $event;

return $this;
}

public function withContextMenu(Menu $menu): self
{
$this->contextMenu = $menu;
Expand Down Expand Up @@ -122,6 +131,7 @@ public function toArray(): array
'onlyShowContextMenu' => $this->onlyShowContextMenu,
'contextMenu' => ! is_null($this->contextMenu) ? $this->contextMenu->toArray()['submenu'] : null,
'alwaysOnTop' => $this->alwaysOnTop,
'event' => $this->event,
];
}
}

0 comments on commit 8a97895

Please sign in to comment.