touchbar-registry

A container for indicators on the Apple Touch bar

haklop

2,209

3

0.3.2

MIT

GitHub

This package provides the following services:

touchbar registry

An abstraction of the touchbar APIs provided by Electron.

API

This package provides a service that you can use in other Atom packages. To use it, include touchbar-registry in the consumedServices section of your package.json:

{
  "name": "my-package",
  "touchbar-registry": {
    "versions": {
      "0.1.0": "consumeTouchBar"
    }
  }
}

Then, in your package's main module, call methods on the service:

deactivate() {...},
activate() {...},
consumeTouchBar(touchbarRegistry) {
  touchbarRegistry.addItem(
    new TouchBarButton({
      label: 'Hello world',
      backgroundColor: '#313440',
      click: () => console.log('Hey!')
    })
  );
}

The touchbar-registry API has four methods:

new TouchBarPopover({
  label: 'a popover',
  items: [
    new TouchBarButton({
      label: 'Button to display in the popover',
      click: () => {
        // do some stuff
        console.log('Hey');

        touchbarRegistry.refresh(); // this is closing the popover
      }
    })
  ]
});

License

This Project is licensed under the terms of MIT License, check the license file for more info.

Inspired by https://github.com/atom/status-bar