tantalic / anybar

A go package for interacting with AnyBar, a macOS menu bar status indicator application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tantalic.com/anybar

codebeat badge Go Report Card GoDoc

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)
}

Installation

go get -u tantalic.com/anybar

API

anybar.Client

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.

Set(s anybar.Style)

func (c *Client) Set(s anybar.Style) error

Sets the style of the AnyBar menu bar icon.

Start()

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.

Quit()

func (c *Client) Quit() error

Send the command to exit the AnyBar app.

anybar.Style

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

About

A go package for interacting with AnyBar, a macOS menu bar status indicator application.

License:MIT License


Languages

Language:Go 100.0%