Touch Bar Utility
Beware This package only works with Atom >=v1.19
An Atom package that allows you to assign custom actions to Touch Bar components.
Usage
- Go to File → Settings → Packages
- Find touch-bar-utility and click on the card but not on the name of the package
- Go to Settings and edit the Buttons entry with a JSON array of Touch Bar components
- A component has the following format: {"type": "<typeOfElement>"[, ...]}
Touch Bar Components
TouchBarButton (type: "button")
Name of variable |
Type of variable |
Optional |
Description |
label |
String |
Yes |
Button text. |
backgroundColor |
String |
Yes |
Button background color in hex format, i.e #ABCDEF. |
pathOfIcon |
String |
Yes |
Path to button icon. |
iconPosition |
String |
Yes |
Can be left, right or overlay. |
click |
Function |
Yes |
Function to call when the button is clicked. |
clickDispatchAction |
String |
Yes |
Event from another package that you want to execute when button is clicked. It will override the click property. It must be in the following format: "<package-name>:<event-name>" without quotation marks. |
dispatchActionTarget |
String |
Yes |
Can have a value of 'workspace' or 'editor'. It defaults to 'workspace'. For proper functioning of the pane commands, set the target to 'editor' |
insertString |
String |
Yes |
Character to be inserted in the active editor when the button is pressed. It will override the clickDispatchAction property. |
TouchBarColorPicker (type: "color-picker")
Name of variable |
Type of variable |
Optional |
Description |
Return values |
Return values type |
Return values description |
availableColors |
String[] |
Yes |
Array of hex color strings to appear as possible colors to select. |
selectedColor |
String |
Yes |
The selected hex color in the picker, i.e #ABCDEF. |
change |
Function |
Yes |
Function to call when a color is selected. |
color |
String |
The color that the user selected from the picker |
TouchBarGroup (type: "group")
Name of variable |
Type of variable |
Optional |
Description |
items |
Array of elements |
No |
Items to display as a group. |
TouchBarLabel (type: "label")
Name of variable |
Type of variable |
Optional |
Description |
label |
String |
Yes |
Text to display. |
textColor |
String |
Yes |
Hex color of text, i.e #ABCDEF. |
TouchBarPopover (type: "popover")
Name of variable |
Type of variable |
Optional |
Description |
label |
String |
Yes |
Popover button text. |
pathOfIcon |
String |
Yes |
Popover button icon. |
items |
Array of elements |
Yes |
Items to display in the popover. Color-pickers and other popovers cannot be placed inside of popovers |
showCloseButton |
Boolean |
Yes |
true to display a close button on the left of the popover, false to not show it. Default is true. |
TouchBarSlider (type: "slider")
Name of variable |
Type of variable |
Optional |
Description |
Return values |
Return values type |
Return values description |
label |
String |
Yes |
Label text. |
value |
Integer |
Yes |
Selected value. |
minValue |
Integer |
Yes |
Minimum value. |
maxValue |
Integer |
Yes |
Maximum value. |
change |
Function |
Yes |
Function to call when the slider is changed. |
newValue |
Number |
The value that the user selected on the Slider |
TouchBarSpacer (type: "spacer")
Name of variable |
Type of variable |
Optional |
Description |
Options |
Options description |
size |
String |
Yes |
Size of spacer, possible values are: |
small |
Small space between items. |
large |
Large space between items. |
flexible |
Take up all available space. |
Images
Touch Bar with Sample Configuration