LouisBrunner / go-touchbar

Go library to integrate the MacBook Touch Bar
Apache License 2.0
1 stars 1 forks source link

go-touchbar Go Reference

Go library to integrate the MacBook Touch Bar

Installation

go get github.com/LouisBrunner/go-touchbar

Usage

// Setup your window code (including NSApplication/NSWindow on macOS)

tb := touchbar.New(touchbar.Options{})

err := tb.Install(Configuration: touchbar.Configuration{
  // Add your configuration here
})
if err != nil {
  // handle
}

// run your application

// when you want to update the touchbar (even from another routine), call do
err = tb.Update(Configuration: touchbar.Configuration{
  // Add your updated configuration here
})
if err != nil {
  // handle
}

err = tb.Uninstall()
if err != nil {
  // handle
}

Configuration

https://user-images.githubusercontent.com/7120871/197391736-450bef36-4dd6-4c79-8ae7-3bd68a932eec.mp4

See example application for a real-life example.

Note: most of the widgets are direct translations of the one in Apple's documentation and have similar options. Please refer to the official documentation for more details.

You configure this library by specifying a list of items from the following options:

But also from this list of standard Apple widgets which have no customizable options: