mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-08 21:37:58 -05:00
Move default mappings to config/key.go
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/aditya-K2/utils"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -16,100 +15,6 @@ var (
|
||||
UserConfigPath = filepath.Join(configDir, "gspt")
|
||||
Config = NewConfigS()
|
||||
OnConfigChange func()
|
||||
DefaultMappings = map[string]map[string]map[Key]string{
|
||||
"recently_played_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"nav_menu": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
},
|
||||
},
|
||||
"search_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"global": {
|
||||
"normal": {
|
||||
{R: 'd'}: "choose_device",
|
||||
{R: '1'}: "focus_nav",
|
||||
{R: '2'}: "focus_playlists",
|
||||
{R: '3'}: "focus_main_view",
|
||||
{R: '?'}: "focus_search",
|
||||
{R: ' '}: "toggle_playback",
|
||||
{R: 'o'}: "open_current_track_album",
|
||||
{R: 'O'}: "open_current_track_artist",
|
||||
{R: 'n'}: "next",
|
||||
{R: 'p'}: "previous",
|
||||
{K: tcell.KeyCtrlO}: "open_current_context",
|
||||
},
|
||||
},
|
||||
"playlist_nav": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"playlist_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"top_tracks_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"liked_songs_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"artists_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
},
|
||||
},
|
||||
"artist_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"albums_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
{R: 'q'}: "queue_entry",
|
||||
},
|
||||
},
|
||||
"album_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
type ConfigS struct {
|
||||
|
||||
@@ -9,6 +9,103 @@ type Key struct {
|
||||
K tcell.Key
|
||||
}
|
||||
|
||||
var (
|
||||
DefaultMappings = map[string]map[string]map[Key]string{
|
||||
"recently_played_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"nav_menu": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
},
|
||||
},
|
||||
"search_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"global": {
|
||||
"normal": {
|
||||
{R: 'd'}: "choose_device",
|
||||
{R: '1'}: "focus_nav",
|
||||
{R: '2'}: "focus_playlists",
|
||||
{R: '3'}: "focus_main_view",
|
||||
{R: '?'}: "focus_search",
|
||||
{R: ' '}: "toggle_playback",
|
||||
{R: 'o'}: "open_current_track_album",
|
||||
{R: 'O'}: "open_current_track_artist",
|
||||
{R: 'n'}: "next",
|
||||
{R: 'p'}: "previous",
|
||||
{K: tcell.KeyCtrlO}: "open_current_context",
|
||||
},
|
||||
},
|
||||
"playlist_nav": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"playlist_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"top_tracks_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"liked_songs_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
"artists_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
},
|
||||
},
|
||||
"artist_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
},
|
||||
},
|
||||
"albums_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{K: tcell.KeyCtrlP}: "play_entry",
|
||||
{R: 'q'}: "queue_entry",
|
||||
},
|
||||
},
|
||||
"album_view": {
|
||||
"normal": {
|
||||
{K: tcell.KeyEnter}: "open_entry",
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
"visual": {
|
||||
{R: 'a'}: "add_to_playlist",
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
M = map[string]tcell.Key{
|
||||
"backspace": tcell.KeyBackspace,
|
||||
|
||||
Reference in New Issue
Block a user