A go package for interacting with AnyBar, a macOS menu bar status indicator application.
The package makes it simple to set the AnyBar icon style:
package main
import (
"tantalic.com/anybar"
)
func main() {
client := anybar.Client{}
client.Set(anybar.Green)
}
go get -u tantalic.com/anybar
A client is used to send commands to an instance of the AnyBar app.
type Client struct {
Port int
Hostname string
}
Client.Port
is the UDP port used to control the AnyBar application. Default value: 1738
.
Client.Hostname
is the host where the AnyBar app is running. Default value localhost
.
func (c *Client) Set(s anybar.Style) error
Sets the style of the AnyBar menu bar icon.
func (c *Client) Start() error
Opens the AnyBar app. If an instance of AnyBar is already running on Client.Port
that instance will be quit first. This function only works on macOS and requires AnyBar.app to be installed.
func (c *Client) Quit() error
Send the command to exit the AnyBar app.
A style represents one of the available appearances that can be set to the AnyBar icon in the menu bar. You should not create your own instances but instead use on of following constants:
anybar.White
anybar.Red
anybar.Orange
anybar.Yellow
anybar.Green
anybar.Cyan
anybar.Blue
anybar.Purple
anybar.Black
anybar.Question
anybar.Exclamation