Help us shape the future of Go! Take the 2026 Go Developer Survey

ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

ABOUTME: Modal picker for audio output devices — shown over the main view ABOUTME: Save-and-restart model: selection writes audio_device to player.yaml

ABOUTME: Hotkey label rendering helper — marks the trigger character with reverse video ABOUTME: Used by all TUI labels that advertise a keybinding so the cue is uniform

ABOUTME: Bubbletea model for player TUI ABOUTME: Defines application state and update logic

ABOUTME: TUI initialization and control ABOUTME: Wraps bubbletea program for player UI

Index

Constants

View Source
const (
	KeySpace  rune = '\uE000' // "Space"
	KeyUp     rune = '\uE001' // "↑"
	KeyDown   rune = '\uE002' // "↓"
	KeyUpDown rune = '\uE003' // "↑↓"
	KeyEnter  rune = '\uE004' // "Enter"
	KeyEsc    rune = '\uE005' // "Esc"
)

Special-key sentinels. These aren't valid Unicode code points that could appear in a label, so overloading a rune-sized value is safe. Any value outside the printable range works; using specific private-use-area code points keeps them self-documenting in stack traces.

Variables

This section is empty.

Functions

func Run

func Run(cfg Config) (*tea.Program, error)

Types

type Config

type Config struct {
	VolumeCtrl    *VolumeControl
	TransportCtrl *TransportControl
	// ConfigPath is where WriteStringKey persists settings like audio_device.
	// Empty disables the Save action in modals that would write to disk.
	ConfigPath string
	// AudioDevice is the device currently driving playback, shown in the
	// status line and used to seed the picker's highlighted row.
	AudioDevice string
}

Config bundles everything the TUI needs from main.go at construction. Extending by adding fields is intentionally cheap — the alternative was growing the Run() / NewModel() positional argument list every time a new TUI feature needs a dependency.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model represents the TUI state

func NewModel

func NewModel(cfg Config) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type QuitMsg

type QuitMsg struct{}

type StatusMsg

type StatusMsg struct {
	Connected     *bool
	ServerName    string
	PlaybackState string
	SyncRTT       int64
	SyncQuality   sync.Quality
	Codec         string
	SampleRate    int
	Channels      int
	BitDepth      int
	Title         string
	Artist        string
	Album         string
	ArtworkPath   string
	Volume        int
	Received      int64
	Played        int64
	Dropped       int64
	BufferDepth   int
	Goroutines    int
}

type TransportControl

type TransportControl struct {
	Commands chan TransportMsg
}

func NewTransportControl

func NewTransportControl() *TransportControl

type TransportMsg

type TransportMsg struct {
	Command string // "play", "pause", "toggle", "next", "previous", "reconnect"
}

type VolumeChangeMsg

type VolumeChangeMsg struct {
	Volume int
	Muted  bool
}

type VolumeControl

type VolumeControl struct {
	Changes chan VolumeChangeMsg
	Quit    chan QuitMsg
}

func NewVolumeControl

func NewVolumeControl() *VolumeControl

Jump to

Keyboard shortcuts

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