Documentation
¶
Index ¶
- Constants
- Variables
- func NavigateCmd(target FocusedModel, exitSearch bool, selectedID spotify.ID, vp tableView) tea.Cmd
- func Run(ctx context.Context, c *config.Config, authenticator authenticator, ...) error
- type AutoplayNextTrackMsg
- type DialogAction
- type DialogContent
- type DialogMsg
- type ErrorTimerExpiredMsg
- type FocusedModel
- type HideDialogMsg
- type KeyMap
- type NavigationMsg
- type ShowDialogWithContentMsg
- type ShowToastMsg
- type TrackRow
- type TrackRowType
Constants ¶
View Source
const ( MainView viewport = iota HelpView )
View Source
const SHRINKWIDTH = 95
Variables ¶
View Source
var ( PrimaryColor = lipgloss.AdaptiveColor{ Light: "#1db954", Dark: "#1db954", } SecondaryColor = lipgloss.AdaptiveColor{ Light: "#f5f5f5", Dark: "#212121", } BorderColor = lipgloss.AdaptiveColor{ Light: "#e0e0e0", Dark: "#535353", } TextColor = lipgloss.AdaptiveColor{ Light: "#333333", Dark: "#b3b3b3", } WhiteTextColor = lipgloss.AdaptiveColor{ Light: "#000000", Dark: "#ffffff", } DangerColor = lipgloss.AdaptiveColor{ Light: "#ff4444", Dark: "#ff4444", } )
View Source
var DefaultKeyMap = KeyMap{ Quit: key.NewBinding( key.WithKeys("ctrl+c"), key.WithHelp("ctrl+c", "quit application"), ), Up: key.NewBinding( key.WithKeys("k", "up"), key.WithHelp("↑/k", "move up"), ), Down: key.NewBinding( key.WithKeys("j", "down"), key.WithHelp("↓/j", "move down"), ), Left: key.NewBinding( key.WithKeys("h", "left"), key.WithHelp("←/h", "previous track"), ), Right: key.NewBinding( key.WithKeys("l", "right"), key.WithHelp("→/l", "next track"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "select track"), ), AddToQueue: key.NewBinding( key.WithKeys("a"), key.WithHelp("a", "Add to queue"), ), ViewQueue: key.NewBinding( key.WithKeys("q"), key.WithHelp("q", "View queue"), ), CycleFocusForward: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "cycle focus forward"), ), CycleFocusBackward: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "cycle focus backward"), ), Copy: key.NewBinding( key.WithKeys("c"), key.WithHelp("c", "copy URL to clipboard"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "show help view"), ), VolumeUp: key.NewBinding( key.WithKeys("shift+up"), key.WithHelp("shift+↑", "increase volume"), ), VolumeDown: key.NewBinding( key.WithKeys("shift+down"), key.WithHelp("shift+↓", "lower volume"), ), Search: key.NewBinding( key.WithKeys("/"), key.WithHelp("/", "search"), ), DeviceDialog: key.NewBinding( key.WithKeys("d"), key.WithHelp("d", "open device dialog"), ), Return: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "return to previous view"), ), Shuffle: key.NewBinding( key.WithKeys("s"), key.WithHelp("s", "toggle shuffle"), ), Previous: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "previous song"), ), PlayPause: key.NewBinding( key.WithKeys(" "), key.WithHelp("space", "play/pause"), ), Next: key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "next song"), ), Repeat: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "cycle repeat mode"), ), VolumeMute: key.NewBinding( key.WithKeys("m"), key.WithHelp("m", "mute/unmute volume"), ), }
View Source
var RoundedTableBorders = table.Border{
Top: "─",
Left: "│",
Right: "│",
Bottom: "─",
TopRight: "╮",
TopLeft: "╭",
BottomRight: "╯",
BottomLeft: "╰",
TopJunction: "─",
LeftJunction: "├",
RightJunction: "┤",
BottomJunction: "─",
InnerJunction: "─",
InnerDivider: " ",
}
Functions ¶
func NavigateCmd ¶
Types ¶
type AutoplayNextTrackMsg ¶
type AutoplayNextTrackMsg struct{}
AutoplayNextTrackMsg is emitted when a song ends and we need to autoplay the next track
type DialogContent ¶
type DialogContent interface {
tea.Model
GetTitle() string
SetSize(width, height int)
HandleDialogKey(msg tea.KeyMsg) (bool, tea.Cmd)
GetActions() []DialogAction
}
func NewDeviceDialog ¶
func NewDeviceDialog(ctx context.Context, spotifyState *state.SpotifyState) DialogContent
type ErrorTimerExpiredMsg ¶
type ErrorTimerExpiredMsg struct{}
type FocusedModel ¶
type FocusedModel int
const ( FocusLibrary FocusedModel = iota FocusSearchBar FocusPlaylistView FocusSearchTracksView FocusSearchPlaylistsView FocusSearchArtistsView FocusSearchAlbumsView FocusQueue )
type HideDialogMsg ¶
type HideDialogMsg struct{}
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
CycleFocusForward key.Binding
CycleFocusBackward key.Binding
//Actions
Select key.Binding
Copy key.Binding
Return key.Binding
AddToQueue key.Binding
// System
Quit key.Binding
Help key.Binding
Search key.Binding
ViewQueue key.Binding
DeviceDialog key.Binding
// Media controls
Shuffle key.Binding
Previous key.Binding
PlayPause key.Binding
Next key.Binding
Repeat key.Binding
VolumeMute key.Binding
VolumeUp key.Binding
VolumeDown key.Binding
}
type NavigationMsg ¶
type NavigationMsg struct {
// contains filtered or unexported fields
}
type ShowDialogWithContentMsg ¶
type ShowDialogWithContentMsg struct {
Content DialogContent
}
type ShowToastMsg ¶
type TrackRow ¶
type TrackRow struct {
Type TrackRowType
Track *spotify.SimpleTrack
Index int
IsQueued bool
}
type TrackRowType ¶
type TrackRowType int
const ( TrackRowLoaded TrackRowType = iota TrackRowLoading )
Click to show internal directories.
Click to hide internal directories.