{"_id":"@egoist/menubar","_rev":"1-29d2d104f0a7a2cac15f1361597f51a7","name":"@egoist/menubar","dist-tags":{"latest":"8.0.2"},"versions":{"8.0.2":{"name":"@egoist/menubar","version":"8.0.2","author":{"name":"Max Ogden"},"bugs":{"url":"https://github.com/maxogden/menubar/issues"},"description":"high level way to create menubar desktop applications with electron","homepage":"https://github.com/maxogden/menubar","keywords":["electron","shell","menubar","menu","taskbar","tray","traybar","mac","linux","windows","app"],"license":"BSD-2-Clause","main":"dist/index.js","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/maxogden/menubar.git"},"scripts":{"build":"rollup -c","deploy":"yarn build && standard-version","docs":"typedoc","lint":"tsc --noEmit && eslint . --ext ts","test":"npm run build"},"types":"dist/index.d.ts","devDependencies":{"electron-positioner":"^4.1.0","@amaurymartiny/config":"^1.0.11","@rollup/plugin-commonjs":"^11.0.2","@types/jest":"^25.1.2","electron":"^8.0.0","jest":"^25.1.0","rimraf":"^3.0.2","rollup":"^2.3.4","rollup-plugin-typescript2":"^0.27.0","standard-version":"^7.1.0","ts-jest":"^25.2.0","typedoc":"^0.16.9","typedoc-plugin-markdown":"^2.2.16","typedoc-plugin-no-inherit":"^1.1.10","typescript":"^3.8.3"},"peerDependencies":{"electron":"^8.0.0"},"gitHead":"b351072bd058a794be1dcc3748749b431cb33624","_id":"@egoist/menubar@8.0.2","_nodeVersion":"12.13.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-/zmSjPL5oEjWyxWwUDjKXSGqdoxsYIwGt5OwS/xyri6TzJoVWZH7TgSeQdAfoNT2im5tt30i+oEWlyJec26PxA==","shasum":"f6e0eb3775439b376eea35a10f632d5476e7e9ab","tarball":"https://registry.npmjs.org/@egoist/menubar/-/menubar-8.0.2.tgz","fileCount":13,"unpackedSize":65338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejhceCRA9TVsSAnZWagAA554P/jYAN7J/qtOnrAiTgwzJ\nLoCntDjw/hIQvxhoUcNImDftcW9HgvdzkDp4AMFhJQqzNhGX+jE+rwfEedQI\nqY38QB500VmyMC5ciaXTbKRWinRRVzmf/N1sOLqUJbPO9pKx/BpZofWg7FlX\nmhahNyY9FdT1Ia7ZJg2JKNdjNvgDj8f1hCy2Jf+OY+O/6DGxmSFqT8ZEPHoM\nP7aW4bKwVHyf8MEtmxWXLdii5hiRlNa1wXH+TGDcoDpXkkkvcKI2Nf2+Jd1W\nrYxkc5leFtkuEYVHhe5WgxWFDVGq8GFRaCQ6nyf5mUj8PLgCvo6w0Pke8qf/\nLIj/b0bQvn1ELzyQ3lZhLfeh+PKsXcyjFRIehPB1qj6J9r/HTEYzLgWNSVIr\nijEK1IHan7gjeI4pThIRG1t45V8+U2xeRbrk+DvzeVxBjYYPUP9XOwvbenvB\n/mzcSXdFWY+Y/YxwkvMmquZwklbr71PigIcCCL1Lxw23oBW5cdludrHNpp6n\n82jgNO3/UOs0V8dZNgwNwpYrrk2Z758bkTXRQKTtTJfy8IdVcKcT8Lb53FqK\ngrJULc7n1DBR+WGCk1CIDmZUGvZnWUb4wyHvUeWddPoYZFDZngXMqYR8+z1g\nqA+XalNBRyG6qrCGqaVZA/XHLXQkqOW+w56uokqlDq6APGAWrhMi1s1c2IdH\nrFeL\r\n=hXPd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID2EIQcnEgxcbacvb+4rYewSvy7UR4ZOPHNkGk+YDuFaAiBmli7l1IrFQ6GY88sP8gWnFY7rQs48BStM0OJzLmm+Uw=="}]},"maintainers":[{"name":"egoist","email":"0x142857@gmail.com"}],"_npmUser":{"name":"egoist","email":"0x142857@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menubar_8.0.2_1586370334341_0.763740434460455"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-08T18:25:34.095Z","8.0.2":"2020-04-08T18:25:34.553Z","modified":"2022-04-05T06:57:18.962Z"},"maintainers":[{"name":"egoist","email":"0x142857@gmail.com"}],"description":"high level way to create menubar desktop applications with electron","homepage":"https://github.com/maxogden/menubar","keywords":["electron","shell","menubar","menu","taskbar","tray","traybar","mac","linux","windows","app"],"repository":{"type":"git","url":"git+https://github.com/maxogden/menubar.git"},"author":{"name":"Max Ogden"},"bugs":{"url":"https://github.com/maxogden/menubar/issues"},"license":"BSD-2-Clause","readme":"[![Build Status](https://travis-ci.org/maxogden/menubar.svg?branch=master)](https://travis-ci.org/maxogden/menubar)\n[![npm (scoped)](https://img.shields.io/npm/v/menubar.svg)](https://www.npmjs.com/package/menubar)\n[![dependencies Status](https://david-dm.org/maxogden/menubar/status.svg)](https://david-dm.org/maxogden/menubar)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/menubar.svg)\n![npm bundle size](https://img.shields.io/bundlephobia/min/menubar.svg)\n[![Buy me a tree](https://img.shields.io/badge/Buy%20me%20a%20tree-%F0%9F%8C%B3-lightgreen)](https://offset.earth/amaurymartiny)\n\n<br /><br /><br />\n\n<h1 align=\"center\">➖ Menubar</h1>\n<h4 align=\"center\">High level way to create menubar desktop applications with Electron.</h4>\n\n<br /><br /><br />\n\nThis module provides boilerplate for setting up a menubar application using Electron. All you have to do is point it at your `index.html` and `menubar` will handle the rest.\n\n✅ Only one dependency, and one peer-dependency.\n\n✅ Works on macOS, Windows and most Linuxes. See [details](./WORKING_PLATFORMS.md).\n\n✅ 💥 [**3.6kB minified + gzipped**](https://bundlephobia.com/result?p=menubar) 💥\n\n| <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\" /> |\n| :-----------------------------------------------------------: | :--------------------------------------------------------: | :------------------------------------------------------: |\n|                      macOS Mojave 10.14                       |                         Windows 10                         |                       Ubuntu 18.04                       |\n\n## Installation\n\n```bash\nyarn add menubar\n```\n\n## Usage\n\nStarting with your own new project, run these commands:\n\n```bash\n$ yarn add menubar\n$ touch myApp.js\n$ touch index.html\n```\n\nFill `index.html` with some HTML, and `myApp.js` like this:\n\n```javascript\nconst { menubar } = require('menubar');\n\nconst mb = menubar();\n\nmb.on('ready', () => {\n  console.log('app is ready');\n  // your app code here\n});\n```\n\nThen use `electron` to run the app:\n\n```bash\n$ electron myApp.js\n```\n\nAlternatively, see [`examples/hello-world`](/examples/hello-world) folder for a simple working example.\n\n## `Menubar` Class\n\nThe return value of `menubar()` is a `Menubar` class instance, which has these properties:\n\n- `app`: the [Electron App](https://electronjs.org/docs/api/app) instance,\n- `window`: the [Electron Browser Window](https://electronjs.org/docs/api/browser-window) instance,\n- `tray`: the [Electron Tray](https://electronjs.org/docs/api/tray) instance,\n- `positioner`: the [Electron Positioner](https://github.com/jenslind/electron-positioner) instance,\n- `setOption(option, value)`: change an option after menubar is created,\n- `getOption(option)`: get an menubar option,\n- `showWindow()`: show the menubar window,\n- `hideWindow()`: hide the menubar window\n\nSee the reference [API docs](./docs/classes/_menubar_.menubar.md).\n\n## `menubar()` Options\n\nYou can pass an optional options object into the `menubar({ ... })` function:\n\n- `dir` (default `process.cwd()`) - the app source directory\n- `index` (default `file:// + opts.dir + index.html`) - The URL to load the menubar's browserWindow with. The url can be a remote address (e.g. `http://`) or a path to a local HTML file using the `file://` protocol.\n- `browserWindow` - BrowserWindow options to be passed to the BrowserWindow constructor, see [Electron docs](https://electronjs.org/docs/api/browser-window#new-browserwindowoptions). Some interesting fields to passed down are:\n  - `x` (default `undefined`) - the x position of the window\n  - `y` (default `undefined`) - the y position of the window\n  - `width` (default 400) - window width\n  - `height` (default 400) - window height\n  - `alwaysOnTop` (default false) - if true, the window will not hide on blur\n- `icon` (default `opts.dir + IconTemplate.png`) - the png icon to use for the menubar. A good size to start with is 20x20. To support retina, supply a 2x sized image (e.g. 40x40) with `@2x` added to the end of the name, so `icon.png` and `icon@2x.png` and Electron will automatically use your `@2x` version on retina screens.\n- `tooltip` (default empty) - menubar tray icon tooltip text\n- `tray` (default created on-the-fly) - an electron `Tray` instance. if provided `opts.icon` will be ignored\n- `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.\n- `showOnAllWorkspaces` (default true) - Makes the window available on all OS X workspaces.\n- `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.\n- `showDockIcon` (default false) - Configure the visibility of the application dock icon.\n- `showOnRightClick` (default false) - Show the window on 'right-click' event instead of regular 'click'\n\nSee the reference [API docs](./docs/interfaces/_types_.options.md).\n\n## Events\n\nThe `Menubar` class is an event emitter:\n\n- `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\n- `create-window` - the line before `new BrowserWindow()` is called\n- `after-create-window` - the line after all window init code is done\n- `show` - the line before `window.show()` is called\n- `after-show` - the line after `window.show()` is called\n- `hide` - the line before `window.hide()` is called (on window blur)\n- `after-hide` - the line after `window.hide()` is called\n- `after-close` - after the `.window` (BrowserWindow) property has been deleted\n- `focus-lost` - emitted if always-on-top option is set and the user clicks away\n\n## Compatibility with Electron\n\n| menubar  | Electron                | Notes                                                                                                                      |\n| -------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |\n| 8.x.x    | 8.x.x                   |                                                                                                                            |\n| 7.x.x    | 7.x.x                   |                                                                                                                            |\n| 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) |\n| <= 5.x.x | <= 3.x.x                | Please, _please_ don't use these old versions                                                                              |\n\n## API Docs\n\nSee the reference [API docs](./docs/globals.md).\n\n## Tips\n\n- 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()`\n- Use `mb.on('focus-lost')` if you would like to perform some operation when using the option `browserWindow.alwaysOnTop: true`\n- To restore focus of previous window after menubar hide, use `mb.on('after-hide', () => { mb.app.hide() } )` or similar\n- 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.\n- 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');`\n","readmeFilename":"README.md"}