view

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the default state file path.

func ParseQueueMode

func ParseQueueMode(value string) core.QueueMode

ParseQueueMode converts a persisted value into a queue mode.

func QueueModeString

func QueueModeString(mode core.QueueMode) string

QueueModeString converts a queue mode into a persisted value.

func Save

func Save(path string, s State) error

Save writes state to path.

Types

type Model

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

func NewModel

func NewModel(appRef *core.App, startDir string, openFiles []string, cfg config.TUIConfig) *Model

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) SaveState

func (m *Model) SaveState() error

func (*Model) Shutdown

func (m *Model) Shutdown()

func (*Model) Update

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

func (*Model) View

func (m *Model) View() tea.View

type State

type State struct {
	BrowserDir    string  `toml:"browser_dir"`
	BrowserHidden bool    `toml:"browser_hidden"`
	Focus         string  `toml:"focus"`
	Volume        *int    `toml:"volume"`
	QueueMode     string  `toml:"queue_mode"`
	Playlist      []Track `toml:"playlist"`
	Playing       int     `toml:"playing"`
	Cursor        int     `toml:"cursor"`
}

State captures UI-related state persisted across runs.

func Load

func Load(path string) (State, error)

Load reads state from path. Missing files return a zero-value State.

type Track

type Track struct {
	Path     string        `toml:"path"`
	Name     string        `toml:"name"`
	Artist   string        `toml:"artist"`
	Title    string        `toml:"title"`
	Album    string        `toml:"album"`
	Duration time.Duration `toml:"duration"`
}

Track captures persisted metadata for a playlist entry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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