-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
924 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package input | ||
|
||
import ( | ||
"github.com/charmbracelet/bubbles/key" | ||
"github.com/dece2183/yamusic-tui/config" | ||
) | ||
|
||
type helpKeyMap struct { | ||
apply key.Binding | ||
cancel key.Binding | ||
|
||
Action string | ||
} | ||
|
||
func newHelpMap() *helpKeyMap { | ||
return &helpKeyMap{ | ||
apply: key.NewBinding( | ||
config.Current.Controls.Apply.Binding(), | ||
config.Current.Controls.Apply.Help("apply"), | ||
), | ||
cancel: key.NewBinding( | ||
config.Current.Controls.Cancel.Binding(), | ||
config.Current.Controls.Cancel.Help("cancel"), | ||
), | ||
} | ||
} | ||
|
||
func (k *helpKeyMap) ShortHelp() []key.Binding { | ||
k.apply.SetHelp(k.apply.Help().Key, k.Action) | ||
return []key.Binding{k.apply, k.cancel} | ||
} | ||
|
||
func (k *helpKeyMap) FullHelp() [][]key.Binding { | ||
return [][]key.Binding{ | ||
k.ShortHelp(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package playlist | ||
|
||
import ( | ||
"github.com/charmbracelet/bubbles/key" | ||
"github.com/dece2183/yamusic-tui/config" | ||
) | ||
|
||
type helpKeyMap struct { | ||
CursorUp key.Binding | ||
CursorDown key.Binding | ||
Rename key.Binding | ||
Renamable bool | ||
} | ||
|
||
func (k helpKeyMap) ShortHelp() []key.Binding { | ||
return []key.Binding{k.CursorUp, k.CursorDown} | ||
} | ||
|
||
func (k helpKeyMap) FullHelp() [][]key.Binding { | ||
if k.Renamable { | ||
return [][]key.Binding{ | ||
k.ShortHelp(), | ||
{k.Rename}, | ||
} | ||
} else { | ||
return [][]key.Binding{ | ||
k.ShortHelp(), | ||
} | ||
} | ||
} | ||
|
||
var helpMap = helpKeyMap{ | ||
CursorUp: key.NewBinding(config.Current.Controls.PlaylistsUp.Binding(), config.Current.Controls.PlaylistsUp.Help("up")), | ||
CursorDown: key.NewBinding(config.Current.Controls.PlaylistsDown.Binding(), config.Current.Controls.PlaylistsDown.Help("down")), | ||
Rename: key.NewBinding(config.Current.Controls.PlaylistsRename.Binding(), config.Current.Controls.PlaylistsRename.Help("rename")), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package tracker | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/bubbles/key" | ||
"github.com/dece2183/yamusic-tui/config" | ||
) | ||
|
||
type helpKeyMap struct { | ||
PlayPause key.Binding | ||
PrevTrack key.Binding | ||
NextTrack key.Binding | ||
LikeUnlike key.Binding | ||
Forward key.Binding | ||
Backward key.Binding | ||
VolUp key.Binding | ||
VolDown key.Binding | ||
} | ||
|
||
var helpMap = helpKeyMap{ | ||
PlayPause: key.NewBinding( | ||
config.Current.Controls.PlayerPause.Binding(), | ||
config.Current.Controls.PlayerPause.Help("play/pause"), | ||
), | ||
PrevTrack: key.NewBinding( | ||
config.Current.Controls.PlayerPrevious.Binding(), | ||
config.Current.Controls.PlayerPrevious.Help("previous track"), | ||
), | ||
NextTrack: key.NewBinding( | ||
config.Current.Controls.PlayerNext.Binding(), | ||
config.Current.Controls.PlayerNext.Help("next track"), | ||
), | ||
LikeUnlike: key.NewBinding( | ||
config.Current.Controls.PlayerLike.Binding(), | ||
config.Current.Controls.PlayerLike.Help("like/unlike"), | ||
), | ||
Backward: key.NewBinding( | ||
config.Current.Controls.PlayerRewindBackward.Binding(), | ||
config.Current.Controls.PlayerRewindBackward.Help(fmt.Sprintf("-%d sec", int(config.Current.RewindDuration))), | ||
), | ||
Forward: key.NewBinding( | ||
config.Current.Controls.PlayerRewindForward.Binding(), | ||
config.Current.Controls.PlayerRewindForward.Help(fmt.Sprintf("+%d sec", int(config.Current.RewindDuration))), | ||
), | ||
VolUp: key.NewBinding( | ||
config.Current.Controls.PlayerVolUp.Binding(), | ||
config.Current.Controls.PlayerVolUp.Help("vol up"), | ||
), | ||
VolDown: key.NewBinding( | ||
config.Current.Controls.PlayerVolDown.Binding(), | ||
config.Current.Controls.PlayerVolDown.Help("vol down"), | ||
), | ||
} | ||
|
||
func (k helpKeyMap) ShortHelp() []key.Binding { | ||
return []key.Binding{k.PlayPause, k.NextTrack, k.PrevTrack, k.LikeUnlike} | ||
} | ||
|
||
func (k helpKeyMap) FullHelp() [][]key.Binding { | ||
return [][]key.Binding{ | ||
{k.PlayPause, k.LikeUnlike}, | ||
{k.NextTrack, k.PrevTrack}, | ||
{k.Forward, k.Backward}, | ||
{k.VolUp, k.VolDown}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.