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/anybarA 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) errorSets the style of the AnyBar menu bar icon.
func (c *Client) Start() errorOpens 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() errorSend 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.Whiteanybar.Redanybar.Orangeanybar.Yellowanybar.Greenanybar.Cyananybar.Blueanybar.Purpleanybar.Blackanybar.Questionanybar.Exclamation