Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hacdias/electron-menubar
Easy way to create an electron menubar application.
https://github.com/hacdias/electron-menubar
electron menubar nodejs tray-application
Last synced: about 1 month ago
JSON representation
Easy way to create an electron menubar application.
- Host: GitHub
- URL: https://github.com/hacdias/electron-menubar
- Owner: hacdias
- License: mit
- Archived: true
- Created: 2017-12-23T10:10:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-27T16:52:01.000Z (almost 3 years ago)
- Last Synced: 2024-08-03T09:08:41.504Z (4 months ago)
- Topics: electron, menubar, nodejs, tray-application
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 38
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - electron-menubar
README
# electron-menubar
> ⚠️ Package no longer maintained. Please [contact me](https://hacdias.com/contact) if you want to become its maintainer.
[![npm](https://img.shields.io/npm/v/electron-menubar.svg?style=flat-square)](https://www.npmjs.com/package/electron-menubar)
[![Travis](https://img.shields.io/travis/hacdias/electron-menubar.svg?style=flat-square)](https://travis-ci.org/hacdias/electron-menubar)This lets you create a menubar very easily with Electron.
## Install
```
npm install --save electron-menubar
```## Documentation
### Class `Menubar`
#### `new Menubar([options])`
- `options` Object (optional)
- `icon` String. The tray's icon. Defaults to `app.getAppPath()/icon.png`.
- `index` String. The index file for the window. Defaults to `app.getAppPath()/index.html`.
- `preloadWindow` Boolean. Tells if the window must be preloaded. Defaults to `false`.
- `showDockIcon` Boolean. Default is `false`.
- `showOnRightClick` Boolean. Default is `false`.
- `showOnAllWorkspaces` Boolean. Default is `false`.
- `tooltip` String. The tray's tooltip.
#### Methods- `menubar.isReady()` tells if the menubar is already ready.
- `menubar.hide()` hides the window.
- `menubar.show()` shows the window.#### Events
- `ready`
- `create-window`
- `after-create-window`
- `hide`
- `after-hide`
- `show`
- `after-show`### Class `Positioner`
- `Positioner.getTaskbarPosition()` returns the position of the taskbar: `top|right|bottom|left`.
- `Positioner.position(window, trayBounds, [alignment])` positions the window in a certain place.
- `window` BrowserWindow. Is the window to position.
- `trayBounds` Rectangle. Are the bounds from the Electron.Tray.
- `alignment` Object. Are the positions to position the window.
- `alignment.x` String. Defaults to `center`. Can be `left|center|right`.
- `alignment.y` String. Defaults to `center`. Can be `up|center|down`.
- `Positioner.calculate(windowBounds, trayBounds, [alignment])` only calculates the position and returns an Object `{x: n, y: k}`.
- `windowBounds` Rectangle. A BrowserWindow bounds.
- `trayBounds` Rectangle. Are the bounds from the Electron.Tray.
- `alignment` Object. Are the positions to position the window.
- `alignment.x` String. Defaults to `center`. Can be `left|center|right`.
- `alignment.y` String. Defaults to `center`. Can be `up|center|down`.## Credits
The code of this project is mainly based on [`menubar`](https://github.com/maxogden/menubar) and [`electron-traywindow-positioner`](https://github.com/pixtron/electron-traywindow-positioner) with some improvements and cleaning.