audio

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultIcons = Icons{
	High:      "\U000f057e",
	Medium:    "\U000f0580",
	Low:       "\U000f057f",
	Zero:      "\U000f057f",
	Mute:      "\U000f0581",
	Bluetooth: "",
}

DefaultIcons is the Nerd Font codepoint set used when the caller doesn't override Audio.Icons. Mute matches Waybar's `format-muted`.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	Interval    time.Duration
	FG          color.RGBA
	BG          color.RGBA
	MutedFG     color.RGBA
	Icons       Icons
	MaxDescRune int // max characters of a bluetooth device description (0 = no limit)
	// contains filtered or unexported fields
}

Audio shells out to wpctl (PipeWire) to read the default sink's volume, mute state and — when relevant — the bluetooth device name.

func New

func New(interval time.Duration, fg, bg color.RGBA) *Audio

func (*Audio) HoverText

func (a *Audio) HoverText() string

HoverText returns extra details about the current audio sink. For Bluetooth sinks it shows the untruncated device name, BlueZ-reported battery percentage (when published) and volume; for regular sinks it returns "" (no popup) since everything the segment shows is already visible. Implements module.Hoverable.

func (*Audio) Name

func (a *Audio) Name() string

func (*Audio) OnClick

func (a *Audio) OnClick(clickID string, button uint32)

func (*Audio) OnScroll

func (a *Audio) OnScroll(clickID string, up bool)

OnScroll changes the default sink volume in 5% steps: scrolling up raises it, down lowers it. The -l 1.0 limit caps the result at 100% so the wheel can't overdrive the sink.

func (*Audio) Render

func (a *Audio) Render() []module.Segment

func (*Audio) Start

func (a *Audio) Start(ctx context.Context) <-chan struct{}

type Icons

type Icons struct {
	High      string
	Medium    string
	Low       string
	Zero      string
	Mute      string
	Bluetooth string
}

Icons groups the per-state audio glyphs. Bluetooth replaces the volume icon when the default sink is a bluez5 device.

Jump to

Keyboard shortcuts

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