Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
menubar-extra
Advanced tools
High level way to create menubar desktop applications with electron. Forked from menubar with extra options.
High level way to create menubar desktop applications with electron
This 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 icon and this will handle opening/closing a window when you click/blur.
Works on Mac OS, Windows and some Linuxes (Tested on Xfce4, your mileage may vary -- patches welcome!)
Mac OS
Windows
Watch the 1HR screen recording of me coding this module: https://www.youtube.com/watch?v=PAJAvsyaHs0
This module was written for + is used by Monu
npm install menubar --save
create a JS program like this:
var menubar = require('menubar')
var mb = menubar()
mb.on('ready', function ready () {
console.log('app is ready')
// your app code here
})
make sure there is also a index.html
file in dir
then use electron
or electron-packager
to build/run the app:
$ npm install electron-prebuilt -g
$ electron your-app.js
see example/
for a working example
the return value of mb
is an event emitter with these properties:
{
app: the electron require('app') instance,
window: the electron require('browser-window') instance,
tray: the electron require('tray') instance,
positioner: the electron-positioner instance,
setOption(option, value): change an option after menubar is created,
getOption(option): get an menubar option,
showWindow(): show the menubar window,
hideWindow(): hide the menubar window
}
you can pass an optional options object into the menubar constructor
dir
(default process.cwd()
) - the app source directoryindex
(default file:// + opts.dir + index.html
) - the html to load for the pop up windowicon
(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.tooltip
(default empty) - menubar tray icon tooltip texttray
(default created on-the-fly) - an electron Tray
instance. if provided opts.icon
will be ignoredpreload-window
(default false) - Create BrowserWindow instance before it is used -- increasing resource usage, but making the click on the menubar load faster.width
(default 400) - window widthheight
(default 400) - window heightx
(default null) - the x position of the windowy
(default null) - the y position of the windowalways-on-top
(default false) - if true, the window will not hide on blurshow-on-all-workspaces
(default true) - Makes the window available on all OS X workspaces.window-position
(default trayCenter and trayBottomCenter on Windows) - Sets the window position (x and y will still override this), check positioner docs for valid values.show-dock-icon
(default false) - Configure the visibility of the application dock icon.show-on-right-click
(default false) - Show the window on 'right-click' event instead of regular 'click'the return value of the menubar constructor is an event emitter
ready
- when the app has been created and initializedcreate-window
- the line before new BrowserWindow is calledafter-create-window
- the line after all window init code is doneshow
- the line before window.show is calledafter-show
- the line after window.show is calledhide
- the line before window.hide is called (on window blur)after-hide
- the line after window.hide is calledafter-close
- after the .window (BrowserWindow) property has been deletedfocus-lost
- emitted if always-on-top option is set and the user clicks awayUse 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 always-on-top:true
FAQs
High level way to create menubar desktop applications with electron. Forked from menubar with extra options.
The npm package menubar-extra receives a total of 0 weekly downloads. As such, menubar-extra popularity was classified as not popular.
We found that menubar-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.