How to use menubar - 10 common examples

To help you get started, we’ve selected a few menubar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ndelvalle / macas / src / main / index.js View on Github external
'use strict'

const path = require('path')
const { menubar } = require('menubar')
const { ipcMain } = require('electron')

/**
 * Set `__static` path to static files in production
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
 */
if (process.env.NODE_ENV !== 'development') {
  global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
}

const mb = menubar({
  browserWindow: {
    transparent: true
  },
  // Note: Icon downloaded from https://icons8.com/icon/1935/display
  icon: path.join(process.cwd(), '/static/favicon/icon.png'),
  index: process.env.NODE_ENV === 'development'
    ? `http://localhost:9080`
    : `file://${__dirname}/index.html`
})

mb.on('ready', () => {
  console.log('Macas app is ready!')
})

ipcMain.on('quit-app', () => mb.app.quit())
github ipfs-shipyard / ipfs-desktop / src / init.js View on Github external
ipfsd.local((err, node) => {
    if (err) {
      // We can't start if we fail to aquire
      // a ipfs node
      logger.error(err)
      process.exit(1)
    }

    mb = menubar(config.menuBar)

    // Ensure single instance
    mb.app.makeSingleInstance(reboot)

    mb.on('ready', () => {
      logger.info('Application is ready')

      // -- load the controls
      require('./controls/open-browser')
      require('./controls/open-console')
      require('./controls/open-settings')

      // tray actions

      mb.tray.on('drop-files', dragDrop)
      mb.tray.setHighlightMode(true)
github OpenBCI / OpenBCI_Hub / src / background.js View on Github external
};

function exitHandler(options, err) {
  if (options.cleanup) {
    if (verbose) console.log("clean");
  }
  if (err) console.log(err.stack);
  if (options.exit) {
    if (verbose) console.log("exit");
    ganglionBLECleanup();
    cytonSerialCleanup();
    wifiCleanup();
  }
}

let mb = menubar({
  icon: path.join(__dirname, "resources", "icons", "icon.png"),
  width: 300,
  height: 400
});

mb.on("ready", function ready() {
  console.log("app is ready");
  // mb.tray.setImage()
  // your app code here
});

mb.on("after-close", function() {
  exitHandler.bind(null, {
    cleanup: true
  });
});
github obiwankenoobi / TinyScratchpad.js / app / main.dev.js View on Github external
//   notification.on("show", () => console.log("notification called"))
  //   notification.show();
  // }



  mainWindow = new BrowserWindow({
    show: false,
    width: 600,
    height: 820,
    webPreferences: {
      devTools: process.env.NODE_ENV === 'development' ? true : false
    }
  });

  const mb = menubar({
    show: false,
    browserWindow: {
      width: 600,
      height: 820,
    },
    index:`file://${__dirname}/app.html`,
    resizable: false
  });

  mb.on('ready', () => {
    console.log('Menubar app is ready.');
  });
github alexcroox / jira-timer-menubar / main.js View on Github external
app.on('ready', async () => {

  // transparency workaround https://github.com/electron/electron/issues/2170
  await delay(10)

  mb = menubar({
    alwaysOnTop: process.env.NODE_ENV === 'development',
    icon: path.join(app.getAppPath(), '/static/tray.png'),
    width: 500,
    minWidth: 500,
    maxWidth: 500,
    minHeight: 530,
    hasShadow: false,
    preloadWindow: true,
    resizable: true,
    transparent: true,
    frame: false,
    toolbar: false
  })

  mb.on('ready', async () => {
    await installExtensions()
github bmathews / menubar-calendar / server / server.js View on Github external
const conf = new Configstore('menu-calendar');

import ElectronGoogleAuth from './oauth/ElectronGoogleAuth';

const oauth = new ElectronGoogleAuth(Object.assign({}, secrets.oauth, {
  scopes: ['profile', 'email', 'https://www.googleapis.com/auth/calendar.readonly']
}));

// conf.clear();

/*
 * Start up the menubar app
 */

const mb = menubar({
  'always-on-top': process.env.NODE_ENV === 'development',
  transparent: true,
  dir: 'client/',
  preloadWindow: true,
  height: 650,
  width: 320
});


/*
 * Gets the auth token, via either:
 *   An existing token from the conf
 *   A new token from a new oauth browser window
 */

const getToken = async () => {
github GooBox / goobox-community-gui / __tests__ / main / popup / handlers / updateState.js View on Github external
it("sets the synchronizing icon when receiving a synchronizing event", async () => {
    await expect(handler({newState: Synchronizing})).resolves.not.toBeDefined();
    expect(menubarMock.tray.setImage).toHaveBeenCalledWith(icons.getSyncIcon());
    expect(menubarMock.appState).toEqual(Synchronizing);
  });
github GooBox / goobox-community-gui / __tests__ / main / popup / index.js View on Github external
it("starts the sia backend if sia conf is true but not running", async () => {
      getConfig.mockResolvedValueOnce({
        sia: true,
        syncFolder,
      });

      await popup();
      expect(getConfig).toHaveBeenCalled();
      expect(siaStart).toHaveBeenCalledWith(syncFolder);
      expect(app.quit).not.toHaveBeenCalled();

      expect(menubarMock.tray.setImage).toHaveBeenCalledWith(
        icons.getSyncIcon()
      );
      expect(menubarMock.appState).toEqual(Synchronizing);
    });
github GooBox / goobox-community-gui / __tests__ / main / popup / handlers / updateState.js View on Github external
it("sets the idle icon when receiving an idle event", async () => {
    await expect(handler({newState: Idle})).resolves.not.toBeDefined();
    expect(menubarMock.tray.setImage).toHaveBeenCalledWith(icons.getIdleIcon());
    expect(menubarMock.appState).toEqual(Idle);
  });
github GooBox / goobox-community-gui / __tests__ / main / popup / hendlers.js View on Github external
it("sets the paused icon when the state is Paused", async () => {
        await expect(handler(Paused)).resolves.toEqual(Paused);
        expect(menubarMock.tray.setImage).toHaveBeenCalledWith(
          icons.getPausedIcon()
        );
        expect(menubarMock.appState).toEqual(Paused);
      });

menubar

high level way to create menubar desktop applications with electron

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

85 / 100
Full package analysis