mango

package
v0.3.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mango is the MangoWM IPC client (wayle-mango): 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

View Source
const SocketEnv = "MANGO_INSTANCE_SIGNATURE"

SocketEnv is constants.rs's SOCKET_PATH_ENV.

Variables

View Source
var ErrNotRunning = errors.New("mango: MANGO_INSTANCE_SIGNATURE is not set")

ErrNotRunning is Error::MangoNotRunning.

Functions

func Dispatch

func Dispatch(command string) error

Dispatch runs one mango dispatcher.

func FocusClient added in v0.3.2

func FocusClient(id uint32) error

FocusClient focuses a client by id, showing its tag.

func IsRunning

func IsRunning() bool

IsRunning reports whether a mango socket is advertised.

func KeyboardLayout

func KeyboardLayout(monitors []Monitor) string

KeyboardLayout is refresh_globals' keyboard_layout: the active monitor's layout; "" when no monitor is active or it reports none.

func KillClient added in v0.3.2

func KillClient(id uint32) error

KillClient asks a client to close by id.

func SocketPath

func SocketPath() string

SocketPath reads the socket path; empty when mango is not running.

func ViewLeft

func ViewLeft() error

ViewLeft is view_left (focus:previous).

func ViewRight

func ViewRight() error

ViewRight is view_right (focus:next).

func ViewTag

func ViewTag(index uint32) error

ViewTag is view_tag: "view,<index>".

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 core/client.rs's Client; empty title/app id read as unset, as from_snapshot filters them.

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 core/monitor.rs's Monitor.

type RejectedError

type RejectedError struct{ Message string }

RejectedError is Error::MangoRejected.

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 types.rs's Tag.

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.

func Watch

func Watch() (*Watcher, error)

Watch connects both watch streams (start_monitoring).

func (*Watcher) Close

func (w *Watcher) Close()

Close drops both streams.

func (*Watcher) Ready

func (w *Watcher) Ready() bool

Ready reports whether both streams have delivered a frame.

func (*Watcher) State

func (w *Watcher) State() ([]Monitor, []Client)

State returns copies of the latest monitors and clients.

func (*Watcher) Ticks

func (w *Watcher) Ticks() <-chan struct{}

Ticks fires after each applied frame; it closes when both streams end.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL