tui

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_DELAY = 5 * time.Second

Message livespan

Variables

View Source
var DefaultKeyMap = KeyMap{
	Up: key.NewBinding(
		key.WithKeys("k", "up"),
		key.WithHelp("↑/k", "move up"),
	),
	Down: key.NewBinding(
		key.WithKeys("j", "down"),
		key.WithHelp("↓/j", "move down"),
	),
	Right: key.NewBinding(
		key.WithKeys("l", "right"),
		key.WithHelp("→/l", "move right"),
	),
	Left: key.NewBinding(
		key.WithKeys("h", "left"),
		key.WithHelp("←/j", "move left"),
	),
	ToggleMute: key.NewBinding(
		key.WithKeys("m"),
		key.WithHelp("m", "mute/unmute"),
	),
	Play: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("Enter", "Play station"),
	),
	VolumeUp: key.NewBinding(
		key.WithKeys("*", "-"),
		key.WithHelp("*", "Increase volume"),
	),
	VolumeDown: key.NewBinding(
		key.WithKeys("/", "-"),
		key.WithHelp("/", "Decrease volume"),
	),
	Quit: key.NewBinding(
		key.WithKeys("ctrl+c", "esc", "q"),
		key.WithHelp("Ctrl+C/Escape/q", "Quit"),
	),
	SaveTrack: key.NewBinding(
		key.WithKeys("ctrl+s"),
		key.WithHelp("Ctrl+s", "Save current track name to track file"),
	),
	Help: key.NewBinding(
		key.WithKeys("h"),
		key.WithHelp("h", "Show All keybindings"),
	),
}

Functions

func CmdSaveTrack added in v0.2.0

func CmdSaveTrack(trackFilePath, track string) tea.Cmd

func CmdTickerMessageBox added in v0.2.2

func CmdTickerMessageBox() tea.Msg

wait 1 sec and then send a Tick

func HeaderToString added in v0.2.0

func HeaderToString(currentStation string, trackName string, volume int, muted bool) string

func InitialModel

func InitialModel(p *player.MpvPlayer, stations []*urls.Station, volume int, trackFilePath string, chanEvent chan mpv.Event) model

Types

type KeyMap

type KeyMap struct {
	Up         key.Binding
	Down       key.Binding
	Right      key.Binding
	Left       key.Binding
	ToggleMute key.Binding
	Play       key.Binding
	Quit       key.Binding
	VolumeUp   key.Binding
	VolumeDown key.Binding
	SaveTrack  key.Binding
	Help       key.Binding
}

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns keybindings for the expanded help view. It's part of the key.Map interface.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns keybindings to be shown in the mini help view. It's part of the key.Map interface.

type Message added in v0.2.2

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

func NewMessage added in v0.2.2

func NewMessage(msg string) *Message

func NewMessageFromErr added in v0.2.2

func NewMessageFromErr(err error) *Message

type MessageBox added in v0.2.2

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

func (*MessageBox) Update added in v0.2.2

func (mb *MessageBox) Update(tmsg tea.Msg) tea.Cmd

Update the Message box

func (*MessageBox) View added in v0.2.2

func (mb *MessageBox) View() string

type SaveTrackMsg added in v0.2.0

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

tea.Msg send by CmdSaveTrack

type TickMessageBox added in v0.2.2

type TickMessageBox struct{}

tea.Msg send by CmdTickerTrackname

Jump to

Keyboard shortcuts

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