You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For macOS, you may use the `vibrancy` method to apply window vibrancy effects:
175
+
```php
176
+
MenuBar::create()->vibrancy('light');
177
+
```
178
+
179
+
To create a solid background color instead:
180
+
```php
181
+
MenuBar::create()->backgroundColor('#ffffff');
182
+
```
165
183
### Menu Bar Window Sizes
166
184
167
185

@@ -176,6 +194,22 @@ MenuBar::create()
176
194
->height(600);
177
195
```
178
196
197
+
### Resizable Window
198
+
199
+
Allow or prevent resizing of the menu bar window:
200
+
```php
201
+
MenuBar::resizable(false);
202
+
```
203
+
204
+
### Positioning
205
+
206
+
You may manually set the position of the menu bar window:
207
+
```php
208
+
MenuBar::create()
209
+
->x(100)
210
+
->y(200);
211
+
```
212
+
179
213
### Menu Bar on Top
180
214
181
215
When developing a menu bar application, you may want to make sure that the menu bar window is always open and on top of all other windows.
@@ -223,6 +257,23 @@ window events to the `nativephp` broadcast channel.
223
257
224
258
To learn more about NativePHP's broadcasting capabilities, please refer to the [Broadcasting](/docs/digging-deeper/broadcasting) section.
225
259
260
+
### Listening for Custom Events
261
+
262
+
Attach a custom event that should be fired when the menu bar icon is clicked. This only works when combined with [`onlyShowContextMenu()`](#context-menu-only):
263
+
```php
264
+
MenuBar::create()->event(MenuBarClicked::class);
265
+
266
+
class MenuBarClicked
267
+
{
268
+
public function __construct(public array $combo, public array $bounds, public array $position)
269
+
{
270
+
// $combo - details of any combo keys pressed when the click occurred
271
+
// $bounds - the current absolute bounds of the menu bar icon at the time of the event
272
+
// $position - the absolute cursor position at the time of the event
273
+
}
274
+
}
275
+
```
276
+
226
277
### `MenuBarShown`
227
278
228
279
The `Native\Laravel\Events\MenuBar\MenuBarShown` event will be dispatched when the user clicks on the menu bar icon and the menu bar window opens, or when
@@ -236,3 +287,10 @@ the menu bar gets hidden by using the `MenuBar::hide()` method.
236
287
### `MenuBarContextMenuOpened`
237
288
238
289
The `Native\Laravel\Events\MenuBar\MenuBarContextMenuOpened` event will be dispatched when the user right-clicks on the menu bar icon and the context menu opens.
290
+
291
+
### Context Menu Only
292
+
293
+
Show only the context menu without opening a window when the menu bar icon is clicked:
0 commit comments