Documentation
¶
Overview ¶
Package mango is the MangoWM IPC client: one-shot "dispatch <command>" requests and the "watch all-monitors" / "watch all-clients" streams, each line a full-state JSON frame. Mango is dwm-derived: every monitor carries a fixed set of tags.
Index ¶
- Constants
- Variables
- func Dispatch(command string) error
- func FocusClient(id uint32) error
- func IsRunning() bool
- func KeyboardLayout(monitors []Monitor) string
- func KillClient(id uint32) error
- func SocketPath() string
- func ViewLeft() error
- func ViewRight() error
- func ViewTag(index uint32) error
- type Client
- type Monitor
- type RejectedError
- type Tag
- type Watcher
Constants ¶
const SocketEnv = "MANGO_INSTANCE_SIGNATURE"
SocketEnv names the variable that locates the mango instance.
Variables ¶
var ErrNotRunning = errors.New("mango: MANGO_INSTANCE_SIGNATURE is not set")
ErrNotRunning is the error when MANGO_INSTANCE_SIGNATURE is unset.
Functions ¶
func FocusClient ¶
FocusClient focuses a client by id, showing its tag.
func KeyboardLayout ¶
KeyboardLayout is the active monitor's layout; "" when no monitor is active or it reports none.
func SocketPath ¶
func SocketPath() string
SocketPath reads the socket path; empty when mango is not running.
Types ¶
type Client ¶
type Client struct {
ID uint32
Title string
HasTitle bool
AppID string
HasAppID bool
Monitor string
Tags []uint32
IsUrgent bool
IsFocused bool
}
Client is a monitor's active client; empty title/app id read as unset.
type Monitor ¶
type Monitor struct {
Name string `json:"name"`
IsActive bool `json:"active"`
Tags []Tag `json:"tags"`
ActiveTags []uint32 `json:"active_tags"`
// KeyboardLayout is the active XKB layout; mango reports it on
// every monitor, empty when unknown.
KeyboardLayout string `json:"keyboardlayout"`
}
Monitor is one monitor of an all-monitors frame.
type RejectedError ¶
type RejectedError struct{ Message string }
RejectedError is mango refusing a dispatch.
func (*RejectedError) Error ¶
func (e *RejectedError) Error() string
type Tag ¶
type Tag struct {
Index uint32 `json:"index"`
IsActive bool `json:"is_active"`
IsUrgent bool `json:"is_urgent"`
Layout string `json:"layout"`
ClientCount uint32 `json:"client_count"`
}
Tag is one tag of a monitor.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher holds the latest monitor and client frames from the two watch streams and ticks after each applied frame.