Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): upgrade all deps #481

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
36 changes: 20 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
> **[menubar](README.md)**
**menubar** • [**Docs**](globals.md)

[Globals](globals.md) /
***

[![Build Status](https://travis-ci.org/maxogden/menubar.svg?branch=master)](https://travis-ci.org/maxogden/menubar)
[![npm (scoped)](https://img.shields.io/npm/v/menubar.svg)](https://www.npmjs.com/package/@maxogden/menubar)
[![dependencies Status](https://david-dm.org/maxogden/menubar/status.svg)](https://david-dm.org/maxogden/menubar)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/max-mapper/menubar/test.yml)
[![npm (scoped)](https://img.shields.io/npm/v/menubar.svg)](https://www.npmjs.com/package/menubar)
![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/max-mapper/menubar)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/menubar.svg)
![npm bundle size](https://img.shields.io/bundlephobia/min/menubar.svg)

Expand All @@ -19,11 +19,11 @@ This module provides boilerplate for setting up a menubar application using Elec

✅ Only one dependency, and one peer-dependency.

✅ Works on macOS, Windows and most Linuxes. See [details](./WORKING_PLATFORMS.md).
✅ Works on macOS, Windows and most Linuxes. See [details](_media/WORKING_PLATFORMS.md).

✅ 💥 [**3.6kB minified + gzipped**](https://bundlephobia.com/result?p=menubar) 💥

| <img src="assets/screenshot-macos-dark.png" height="250px" /> | <img src="assets/screenshot-windows.png" height="250px" /> | <img src="assets/screenshot-linux.png" height="250px" /> |
| <img src="_media/screenshot-macos-dark.png" height="250px" /> | <img src="_media/screenshot-windows.png" height="250px" /> | <img src="_media/screenshot-linux.png" height="250px" /> |
| :-----------------------------------------------------------: | :--------------------------------------------------------: | :------------------------------------------------------: |
| macOS Mojave 10.14 | Windows 10 | Ubuntu 18.04 |

Expand Down Expand Up @@ -95,6 +95,7 @@ You can pass an optional options object into the `menubar({ ... })` function:
- `tooltip` (default empty) - menubar tray icon tooltip text
- `tray` (default created on-the-fly) - an electron `Tray` instance. if provided `opts.icon` will be ignored
- `preloadWindow` (default false) - Create [BrowserWindow](https://electronjs.org/docs/api/browser-window#new-browserwindowoptions) instance before it is used -- increasing resource usage, but making the click on the menubar load faster.
- `loadUrlOptions` - (default undefined) The options passed when loading the index URL in the menubar's browserWindow. Everything browserWindow.loadURL supports is supported; this object is simply passed onto [browserWindow.loadURL](https://electronjs.org/docs/api/browser-window#winloadurlurl-options)
- `showOnAllWorkspaces` (default true) - Makes the window available on all OS X workspaces.
- `windowPosition` (default trayCenter and trayBottomCenter on Windows) - Sets the window position (x and y will still override this), check [positioner docs](https://github.com/jenslind/electron-positioner#docs) for valid values.
- `showDockIcon` (default false) - Configure the visibility of the application dock icon.
Expand All @@ -108,7 +109,8 @@ The `Menubar` class is an event emitter:

- `ready` - when `menubar`'s tray icon has been created and initialized, i.e. when `menubar` is ready to be used. Note: this is different than Electron app's `ready` event, which happens much earlier in the process
- `create-window` - the line before `new BrowserWindow()` is called
- `after-create-window` - the line after all window init code is done
- `before-load` - after create window, before loadUrl (can be used for `require("@electron/remote/main").enable(webContents)`)
- `after-create-window` - the line after all window init code is done and url was loaded
- `show` - the line before `window.show()` is called
- `after-show` - the line after `window.show()` is called
- `hide` - the line before `window.hide()` is called (on window blur)
Expand All @@ -118,20 +120,22 @@ The `Menubar` class is an event emitter:

## Compatibility with Electron

| menubar | Electron | Notes |
| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 7.x.x | 7.x.x |
| 6.x.x | 4.x.x \| 5.x.x \| 6.x.x | Not recommended for [security reasons](https://electronjs.org/docs/tutorial/security#17-use-a-current-version-of-electron) |
| <= 5.x.x | <= 3.x.x | Please, _please_ don't use these old versions |
| menubar | Electron | Notes |
| -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 9.x.x | >=9.x.x <33.x.x | |
| 8.x.x | 8.x.xx | |
| 7.x.x | 7.x.xx | |
| 6.x.x | >=4.x.x <7.x.x | Not recommended for [security reasons](https://electronjs.org/docs/tutorial/security#17-use-a-current-version-of-electron) |
| <= 5.x.x | <= 3.x.x | Please, _please_ don't use these old versions |

## API Docs

See the reference [API docs](./docs/globals.md).
See the reference [API docs](_media/globals.md).

## Tips

- Use `mb.on('after-create-window', callback)` to run things after your app has loaded. For example you could run `mb.window.openDevTools()` to open the developer tools for debugging, or load a different URL with `mb.window.loadUrl()`
- Use `mb.on('after-create-window', callback)` to run things after your app has loaded. For example you could run `mb.window.openDevTools()` to open the developer tools for debugging, or load a different URL with `mb.window.loadURL()`
- Use `mb.on('focus-lost')` if you would like to perform some operation when using the option `browserWindow.alwaysOnTop: true`
- To restore focus of previous window after menubar hide, use `mb.on('after-hide', () => { mb.app.hide() } )` or similar
- To create a native menu, you can use `tray.setContextMenu(contextMenu)`, and pass this custom tray to menubar: `const mb = menubar({ tray });`. See [this example](https://github.com/maxogden/menubar/tree/master/examples/native-menu) for more information.
- To avoid a flash when opening your menubar app, you can disable backgrounding the app using the following: `mb.app.commandLine.appendSwitch('disable-backgrounding-occluded-windows', 'true');`
- To avoid a flash when opening your menubar app, you can disable backgrounding the app using the following: `mb.app.commandLine.appendSwitch('disable-backgrounding-occluded-windows', 'true');`
27 changes: 27 additions & 0 deletions docs/_media/WORKING_PLATFORMS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Platforms where `menubar` is known to work

This document is still a work-in-progress. If you have tested `menubar` with a platform that is not listed under here, I would greatly appreciate a PR!

## macOS

| Version | Working Status | Known Issues |
| ----------------- | -------------- | -------------------------------------------------------------------------------------------------------------- |
| 14.15 Sonoma | ✅ Good | |
| 10.14 Mojave | ✅ Good | [#147](https://github.com/maxogden/menubar/issues/147), [#215](https://github.com/maxogden/menubar/issues/215) |
| 10.13 High Sierra | ✅ Good | |

## Windows

| Version | Working Status | Known Issues |
| ---------- | -------------- | ------------ |
| Windows 11 | ✅ Good | |
| Windows 10 | ✅ Good | |
| Windows 8 | ✅ Good | |

## Linux

| Distribution | Desktop Environment | Working Status | Known Issues |
| ------------- | ------------------- | -------------- | ------------------------------------------------------ |
| openSUSE 13.1 | Xfce 4.10.1 | ❌ Bad | [#123](https://github.com/maxogden/menubar/issues/123) |
| Ubuntu 18.04 | Unity | ✅ Good | |
| Ubuntu 14.04 | Unity | ❌ Bad | [#68](https://github.com/maxogden/menubar/issues/68) |
15 changes: 15 additions & 0 deletions docs/_media/globals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[**menubar**](README.md) • **Docs**

***

# menubar

## Classes

- [Menubar](classes/Menubar.md)

## Functions

- [getWindowPosition](functions/getWindowPosition.md)
- [menubar](functions/menubar.md)
- [taskbarLocation](functions/taskbarLocation.md)
Binary file added docs/_media/screenshot-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/screenshot-macos-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/screenshot-windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
174 changes: 174 additions & 0 deletions docs/classes/Menubar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
[**menubar**](../README.md) • **Docs**

***

[menubar](../globals.md) / Menubar

# Class: Menubar

The main Menubar class.

## Extends

- `EventEmitter`

## Accessors

### app

> `get` **app**(): `App`

The Electron [App](https://electronjs.org/docs/api/app)
instance.

#### Returns

`App`

#### Defined in

[Menubar.ts:46](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L46)

***

### positioner

> `get` **positioner**(): `default`

The [electron-positioner](https://github.com/jenslind/electron-positioner)
instance.

#### Returns

`default`

#### Defined in

[Menubar.ts:54](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L54)

***

### tray

> `get` **tray**(): `Tray`

The Electron [Tray](https://electronjs.org/docs/api/tray) instance.

#### Returns

`Tray`

#### Defined in

[Menubar.ts:67](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L67)

***

### window

> `get` **window**(): `undefined` \| `BrowserWindow`

The Electron [BrowserWindow](https://electronjs.org/docs/api/browser-window)
instance, if it's present.

#### Returns

`undefined` \| `BrowserWindow`

#### Defined in

[Menubar.ts:81](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L81)

## Methods

### getOption()

> **getOption**\<`K`\>(`key`): `Options`\[`K`\]

Retrieve a menubar option.

#### Type Parameters

• **K** *extends* keyof `Options`

#### Parameters

• **key**: `K`

The option key to retrieve, see Options.

#### Returns

`Options`\[`K`\]

#### Defined in

[Menubar.ts:90](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L90)

***

### hideWindow()

> **hideWindow**(): `void`

Hide the menubar window.

#### Returns

`void`

#### Defined in

[Menubar.ts:97](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L97)

***

### setOption()

> **setOption**\<`K`\>(`key`, `value`): `void`

Change an option after menubar is created.

#### Type Parameters

• **K** *extends* keyof `Options`

#### Parameters

• **key**: `K`

The option key to modify, see Options.

• **value**: `Options`\[`K`\]

The value to set.

#### Returns

`void`

#### Defined in

[Menubar.ts:117](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L117)

***

### showWindow()

> **showWindow**(`trayPos`?): `Promise`\<`void`\>

Show the menubar window.

#### Parameters

• **trayPos?**: `Rectangle`

The bounds to show the window in.

#### Returns

`Promise`\<`void`\>

#### Defined in

[Menubar.ts:126](https://github.com/max-mapper/menubar/blob/9dfd6c1353193306024f315a191d68a0c6e1fa38/src/Menubar.ts#L126)
Loading