From 94ae6af7f10ee65bf663ea08600bf967189354be Mon Sep 17 00:00:00 2001 From: jjohnstondev Date: Sun, 8 Jan 2023 23:27:53 -0800 Subject: [PATCH] add keymap --- internal/tui/list.go | 6 ++++++ internal/tui/playlisttracks.go | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/tui/list.go b/internal/tui/list.go index 2570ce9..e2a4123 100644 --- a/internal/tui/list.go +++ b/internal/tui/list.go @@ -8,6 +8,7 @@ import ( "gospt/internal/commands" "gospt/internal/gctx" + "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/list" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" @@ -134,6 +135,11 @@ func DisplayList(ctx *gctx.Context, client *spotify.Client) error { ctx: ctx, client: client, } + m.list.AdditionalShortHelpKeys = func() []key.Binding { + return []key.Binding{ + key.NewBinding(key.WithKeys("ctrl", "r"), key.WithHelp("ctrl+r", "start radio")), + } + } m.list.Title = "Saved Tracks" p := tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion()) diff --git a/internal/tui/playlisttracks.go b/internal/tui/playlisttracks.go index c32c23a..939ff29 100644 --- a/internal/tui/playlisttracks.go +++ b/internal/tui/playlisttracks.go @@ -8,6 +8,7 @@ import ( "gospt/internal/commands" "gospt/internal/gctx" + "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/list" tea "github.com/charmbracelet/bubbletea" "github.com/zmb3/spotify/v2" @@ -135,7 +136,11 @@ func PlaylistTracks(ctx *gctx.Context, client *spotify.Client, playlist spotify. playlist: playlist, } m.list.Title = playlist.Name - + m.list.AdditionalShortHelpKeys = func() []key.Binding { + return []key.Binding{ + key.NewBinding(key.WithKeys("ctrl", "r"), key.WithHelp("ctrl+r", "start radio")), + } + } p := tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion()) if _, err := p.Run(); err != nil {