menubar

  • Version 9.5.1
  • Published
  • 720 kB
  • 1 dependency
  • BSD-2-Clause license

Install

npm i menubar
yarn add menubar
pnpm add menubar

Overview

high level way to create menubar desktop applications with electron

Index

Functions

function getWindowPosition

getWindowPosition: (tray: Tray) => WindowPosition;
  • Depending on where the taskbar is, determine where the window should be positioned.

    Parameter tray

    The Electron Tray instance.

menubar: (options?: Partial<Options>) => Menubar;
  • Factory function to create a menubar application

    Parameter options

    Options for creating a menubar application, see Options

function taskbarLocation

taskbarLocation: (tray: Tray) => TaskbarLocation;
  • Determine taskbard location: "top", "bottom", "left" or "right".

    Only tested on Windows for now, and only used in Windows.

    Parameter tray

    The Electron Tray instance.

Classes

class Menubar extends EventEmitter {}
  • The main Menubar class.

constructor(app: Electron.App, options?: Partial<Options>);
    readonly app: Electron.App;
    • The Electron [App](https://electronjs.org/docs/api/app) instance.

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

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

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

    getOption: <K extends keyof Options>(key: K) => Options[K];
    • Retrieve a menubar option.

      Parameter key

      The option key to retrieve, see Options.

    hideWindow: () => void;
    • Hide the menubar window.

    setOption: <K extends keyof Options>(key: K, value: Options[K]) => void;
    • Change an option after menubar is created.

      Parameter key

      The option key to modify, see Options.

      Parameter value

      The value to set.

    showWindow: (trayPos?: Electron.Rectangle) => Promise<void>;
    • Show the menubar window.

      Parameter trayPos

      The bounds to show the window in.

    Package Files (3)

    Dependencies (1)

    Dev Dependencies (11)

    Peer Dependencies (1)

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/menubar.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/menubar)
    • HTML
      <a href="https://www.jsdocs.io/package/menubar"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>