config

package
v0.0.0-...-78ec99f Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageHidden    string = "hidden"
	ImageShow      string = "show"
	CornersRounded string = "rounded"
	CornersDefault string = "default"
)

Variables

View Source
var (
	Config         = newConfigS()
	OnConfigChange func()
)
View Source
var (
	M = map[string]tcell.Key{
		"backspace":       tcell.KeyBackspace,
		"tab":             tcell.KeyTab,
		"esc":             tcell.KeyEsc,
		"escape":          tcell.KeyEscape,
		"enter":           tcell.KeyEnter,
		"backspace2":      tcell.KeyBackspace2,
		"ctrl-space":      tcell.KeyCtrlSpace,
		"ctrl-a":          tcell.KeyCtrlA,
		"ctrl-b":          tcell.KeyCtrlB,
		"ctrl-c":          tcell.KeyCtrlC,
		"ctrl-d":          tcell.KeyCtrlD,
		"ctrl-e":          tcell.KeyCtrlE,
		"ctrl-f":          tcell.KeyCtrlF,
		"ctrl-g":          tcell.KeyCtrlG,
		"ctrl-h":          tcell.KeyCtrlH,
		"ctrl-i":          tcell.KeyCtrlI,
		"ctrl-j":          tcell.KeyCtrlJ,
		"ctrl-k":          tcell.KeyCtrlK,
		"ctrl-l":          tcell.KeyCtrlL,
		"ctrl-m":          tcell.KeyCtrlM,
		"ctrl-n":          tcell.KeyCtrlN,
		"ctrl-o":          tcell.KeyCtrlO,
		"ctrl-p":          tcell.KeyCtrlP,
		"ctrl-q":          tcell.KeyCtrlQ,
		"ctrl-r":          tcell.KeyCtrlR,
		"ctrl-s":          tcell.KeyCtrlS,
		"ctrl-t":          tcell.KeyCtrlT,
		"ctrl-u":          tcell.KeyCtrlU,
		"ctrl-v":          tcell.KeyCtrlV,
		"ctrl-w":          tcell.KeyCtrlW,
		"ctrl-x":          tcell.KeyCtrlX,
		"ctrl-y":          tcell.KeyCtrlY,
		"ctrl-z":          tcell.KeyCtrlZ,
		"ctrl-leftsq":     tcell.KeyCtrlLeftSq,
		"ctrl-backslash":  tcell.KeyCtrlBackslash,
		"ctrl-rightsq":    tcell.KeyCtrlRightSq,
		"ctrl-carat":      tcell.KeyCtrlCarat,
		"ctrl-underscore": tcell.KeyCtrlUnderscore,
		"up":              tcell.KeyUp,
		"down":            tcell.KeyDown,
		"right":           tcell.KeyRight,
		"left":            tcell.KeyLeft,
		"up_left":         tcell.KeyUpLeft,
		"up_right":        tcell.KeyUpRight,
		"down_left":       tcell.KeyDownLeft,
		"down_right":      tcell.KeyDownRight,
		"center":          tcell.KeyCenter,
		"pgup":            tcell.KeyPgUp,
		"pgdn":            tcell.KeyPgDn,
		"home":            tcell.KeyHome,
		"end":             tcell.KeyEnd,
		"insert":          tcell.KeyInsert,
		"delete":          tcell.KeyDelete,
		"help":            tcell.KeyHelp,
		"exit":            tcell.KeyExit,
		"clear":           tcell.KeyClear,
		"cancel":          tcell.KeyCancel,
		"print":           tcell.KeyPrint,
		"pause":           tcell.KeyPause,
		"backtab":         tcell.KeyBacktab,
	}
	RuneKeys = map[rune]bool{
		'!':  true,
		'@':  true,
		'#':  true,
		'$':  true,
		'%':  true,
		'^':  true,
		'&':  true,
		'*':  true,
		'(':  true,
		')':  true,
		'-':  true,
		'=':  true,
		'_':  true,
		'+':  true,
		',':  true,
		'.':  true,
		'<':  true,
		'>':  true,
		'/':  true,
		'?':  true,
		'[':  true,
		']':  true,
		'{':  true,
		'}':  true,
		'|':  true,
		'\\': true,
		':':  true,
		';':  true,
		'\'': true,
		'"':  true,
		' ':  true,
	}
)
View Source
var (
	DefaultMappings = map[string]map[string]map[Key]string{
		"recently_played_view": {
			"normal": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
			"visual": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
		},
		"search_view": {
			"normal": {
				{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",
				{K: tcell.KeyEnter}: "open_entry",
				{K: tcell.KeyCtrlH}: "move_image_left",
				{K: tcell.KeyCtrlJ}: "move_image_down",
				{K: tcell.KeyCtrlK}: "move_image_up",
				{K: tcell.KeyCtrlL}: "move_image_right",
				{R: 'H'}:            "decrease_image_width",
				{R: 'J'}:            "increase_image_height",
				{R: 'K'}:            "decrease_image_height",
				{R: 'L'}:            "increase_image_width",
				{K: tcell.KeyCtrlS}: "save_config",
				{R: 'z'}:            "shuffle",
				{R: 'r'}:            "repeat",
			},
		},
		"playlist_nav": {
			"normal": {
				{K: tcell.KeyCtrlP}: "play_entry",
				{R: 'q'}:            "queue_entry",
			},
		},
		"playlist_view": {
			"normal": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
			"visual": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
		},
		"top_tracks_view": {
			"normal": {
				{K: tcell.KeyCtrlP}: "play_entry",
				{R: 'q'}:            "queue_entry",
			},
		},
		"liked_songs_view": {
			"normal": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
			"visual": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
		},
		"artists_view": {
			"normal": {
				{K: tcell.KeyCtrlP}: "play_entry",
			},
		},
		"artist_view": {
			"normal": {
				{K: tcell.KeyCtrlP}: "play_entry",
				{R: 'q'}:            "queue_entry",
			},
		},
		"albums_view": {
			"normal": {
				{K: tcell.KeyCtrlP}: "play_entry",
				{R: 'q'}:            "queue_entry",
			},
		},
		"album_view": {
			"normal": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
			"visual": {
				{R: 'a'}: "add_to_playlist",
				{R: 'q'}: "queue_entry",
			},
		},
		"nav_menu": {},
	}
)
View Source
var (
	Flags = &Flag{}
)

Functions

func GenerateMappings

func GenerateMappings() map[string]map[string]map[Key]string

func ReadConfig

func ReadConfig() error

func WriteConfig

func WriteConfig() error

Types

type Color

type Color struct {
	Fg     string `mapstructure:"fg"`
	Bg     string `yaml:"bg,omitempty" mapstructure:"bg"`
	Bold   bool   `mapstructure:"bold"`
	Italic bool   `mapstructure:"italic"`
}

func (Color) Background

func (c Color) Background() tcell.Color

func (Color) Foreground

func (c Color) Foreground() tcell.Color

func (Color) String

func (c Color) String() string

func (Color) Style

func (c Color) Style() tcell.Style

type Colors

type Colors struct {
	Artist      Color `mapstructure:"artist"`
	Album       Color `mapstructure:"album"`
	Track       Color `mapstructure:"track"`
	Genre       Color `mapstructure:"genre"`
	Folder      Color `mapstructure:"folder"`
	Timestamp   Color `mapstructure:"timestamp"`
	PBarArtist  Color `yaml:"pbar_artist" mapstructure:"pbar_artist"`
	PBarTrack   Color `yaml:"pbar_track" mapstructure:"pbar_track"`
	PlaylistNav Color `yaml:"playlist_nav" mapstructure:"playlist_nav"`
	Nav         Color `mapstructure:"nav"`
	ContextMenu Color `yaml:"context_menu" mapstructure:"context_menu"`
	BorderFocus Color `yaml:"border_focus" mapstructure:"border_focus"`
	Border      Color `mapstructure:"border"`

	Null Color
}

func NewColors

func NewColors() *Colors

type Flag

type Flag struct {
	ConfigPath string
	Version    bool
	Image      string
	Corners    string
	UseIcons   bool
}

type Icons

type Icons struct {
	Computer    string `mapstructure:"computer"`
	Tablet      string `mapstructure:"tablet"`
	Smartphone  string `mapstructure:"smartphone"`
	Speaker     string `mapstructure:"speaker"`
	Tv          string `mapstructure:"tv"`
	Avr         string `mapstructure:"avr"`
	Stb         string `mapstructure:"stb"`
	AudioDongle string `yaml:"audio_dongle" mapstructure:"audio_dongle"`
	GameConsole string `yaml:"game_console" mapstructure:"game_console"`
	CastVideo   string `yaml:"cast_video" mapstructure:"cast_video"`
	CastAudio   string `yaml:"cast_audio" mapstructure:"cast_audio"`
	Automobile  string `mapstructure:"automobile"`
	Playing     string `mapstructure:"playing"`
	Paused      string `mapstructure:"paused"`
	ShuffleOn   string `yaml:"shuffle_on" mapstructure:"shuffle_on"`
	ShuffleOff  string `yaml:"shuffle_off" mapstructure:"shuffle_off"`
	RepeatOne   string `yaml:"repeat_one" mapstructure:"repeat_one"`
	RepeatAll   string `yaml:"repeat_all" mapstructure:"repeat_all"`
	RepeatOff   string `yaml:"repeat_off" mapstructure:"repeat_off"`
}

func NewIcons

func NewIcons() *Icons

type Key

type Key struct {
	R rune
	K tcell.Key
}

func NewKey

func NewKey(s string) Key

func (*Key) Key

func (k *Key) Key() tcell.Key

func (*Key) Rune

func (k *Key) Rune() rune

Jump to

Keyboard shortcuts

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