A bare bones setup for creating shortcut touch bar applications using
electron
.
In order to create TouchBar
items within electron
, an instance of a BrowserWindow
must be focused in order for the items to show. This project satisfies that requirement by creating a dummy/invisible browser window that can be focused on-demand via a globalShortcut
. Once you activate your touch bar action you can hide the application using app.hide()
or by hitting esc. Doing so will restore focus to the previous application.
The default globalShortcut
for opening the touch bar app is Command + Shift + 2.
This setup doesn't include too much, but gets you up and running with a nice development environment with support for electron
reloading via nodemon
and ES Module support thanks to esm
.
# clone down the project
git clone https://github.com/SimulatedGREG/electron-touchbar-shortcuts.git
# install dependencies
yarn
# run development setup
yarn serve
It's rather simple. All files within the actions
directory are all individual TouchBar items, and each file is expected to export one of the supported TouchBar
item types.
- TouchBarButton
- TouchBarColorPicker
- TouchBarGroup
- TouchBarLabel
- TouchBarPopover
- TouchBarScrubber
- TouchBarSegmentedControl
- TouchBarSlider
- TouchBarSpacer
See full documentation at https://electronjs.org/docs/api/touch-bar.
There really isn't much more to this project. Now it's your turn to make your own actions that fit your workflow. Have fun!
- Packaging with
electron-builder