Documentation
¶
Overview ¶
Package config handles user configuration persistence
Package config handles user configuration and theme loading
Index ¶
- Constants
- Variables
- func GetCachedTerminalColors() (fg, bg string, palette map[int]string, success bool)
- func GetScrobbleCacheDir() string
- func GetTerminalColors() (fg, bg string, palette map[int]string, err error)
- func InSSHSession() bool
- func IsTerminalColorAvailable() bool
- func ParsePaletteColor(n int) (string, error)
- func TestTerminalColors() (fg, bg string, palette map[int]string, fallback bool, err error)
- func ThemeNames() []string
- type AudioConfig
- type ColorTheme
- type Config
- type JukeboxConfig
- type LastFMConfig
- type LidarrConfig
- type ListenBrainzConfig
- type RPAuthConfig
- type StationIssue
- type TerminalColors
- type TerminalPaletteConfig
- type ThemeStyles
- type ThemeWatcher
- type VisualizerConfig
Constants ¶
const ( IdxCursor = 2 // green IdxAccent = 4 // blue IdxMuted = 8 // gray )
Standard palette indices for fallback when terminal queries fail
Variables ¶
var BitrateNames = map[int]string{
1: "64k AAC",
2: "128k AAC",
3: "320k AAC",
4: "FLAC",
}
Bitrate names mapping
var StationNames = map[int]string{
0: "The Main Mix",
1: "Mellow Mix",
2: "RockIt!",
3: "The Globe",
5: "Beyond...",
42: "Serenity",
99: "My Paradise",
945: "KFAT",
}
Station names mapping
Functions ¶
func GetCachedTerminalColors ¶ added in v1.1.0
GetCachedTerminalColors returns cached results (no query).
func GetScrobbleCacheDir ¶
func GetScrobbleCacheDir() string
GetScrobbleCacheDir returns the scrobble cache directory path.
func GetTerminalColors ¶ added in v1.1.0
GetTerminalColors returns the terminal's default colors. Queries the terminal once and caches the results.
func InSSHSession ¶ added in v1.3.0
func InSSHSession() bool
InSSHSession returns true if the current process is running inside an SSH session
func IsTerminalColorAvailable ¶ added in v1.1.0
func IsTerminalColorAvailable() bool
IsTerminalColorAvailable checks if terminal colors were successfully queried
func ParsePaletteColor ¶ added in v1.1.0
ParsePaletteColor queries a single palette color via OSC 4 This is not implemented in termenv, so we provide a placeholder
func TestTerminalColors ¶ added in v1.1.0
TestTerminalColors prints detected colors for debugging. Returns map of index to hex color for palette indices 0-15.
func ThemeNames ¶
func ThemeNames() []string
ThemeNames returns the list of available built-in theme names
Types ¶
type AudioConfig ¶ added in v1.3.0
type AudioConfig struct {
SSHAudioServer string `` /* 374-byte string literal not displayed */
}
AudioConfig holds audio output settings
type ColorTheme ¶
type ColorTheme struct {
Background string `toml:"background"`
Foreground string `toml:"foreground"`
Accent string `toml:"accent"`
Muted string `toml:"muted"`
Cursor string `toml:"cursor"`
}
ColorTheme represents a color scheme loaded from TOML
func BuiltinTheme ¶
func BuiltinTheme(name string) *ColorTheme
BuiltinTheme returns a built-in theme by name, or nil if not found
func LoadTheme ¶
func LoadTheme(colorsFile, themeName string) (*ColorTheme, error)
LoadTheme loads theme with fallback chain Priority: 1. User-provided colors_file (if set in config) 2. Named built-in theme (if set and valid) 3. Omarchy: ~/.config/omarchy/current/theme/colors.toml 4. Defaults (Catppuccin Mocha)
type Config ¶
type Config struct {
Channel int `` /* 201-byte string literal not displayed */
Bitrate int `toml:"bitrate" comment:"1=64k AAC, 2=128k AAC, 3=320k AAC, 4=FLAC (default: 3)"`
ShowAlbumArt bool `` /* 172-byte string literal not displayed */
CopyAlbumArt bool `toml:"copy_album_art" comment:"save album art to file, useful for desktop/statusbar widgets (default: false)"`
AlbumArtPath string `toml:"album_art_path" comment:"file path for album art copy, needed if copy_album_art is true (default: /tmp/cover.jpg)"`
FavoritesDir string `toml:"favorites_dir" comment:"directory for favorites metadata and audio files (default: XDG_CACHE_HOME/rptui/favorites)"`
MaxFavorites int `` /* 131-byte string literal not displayed */
MinFavorites int `` /* 191-byte string literal not displayed */
ShowSkipWarning bool `` /* 139-byte string literal not displayed */
ColorsFile string `` /* 186-byte string literal not displayed */
Theme string `toml:"theme" comment:"built-in theme name\ncatppuccin-mocha, gruvbox-dark, dark-red, osaka-jade, synth, basic (default: '')"`
TransparentBackground bool `toml:"transparent_background" comment:"use terminal's default background color (default: false)"`
DisableTheme bool `toml:"disable_theme" comment:"disable all theming, use terminal's default colors (default: false)"`
// Terminal palette indices (used when disable_theme = true)
TerminalPalette TerminalPaletteConfig `toml:"terminal_palette" comment:"palette indices for cursor/accent/muted when disable_theme is true"`
// Discogs API authentication (optional, enables images + higher rate limits)
// Auth priority: discogs_token (personal access) > discogs_key+discogs_secret (developer app) > env vars > unauthenticated
DiscogsToken string `` /* 284-byte string literal not displayed */
DiscogsKey string `` /* 144-byte string literal not displayed */
DiscogsSecret string `` /* 150-byte string literal not displayed */
// Scrobble services
LastFM LastFMConfig `toml:"lastfm" comment:"Last.fm scrobbling\nrun 'rptui --lastfm-auth' once to obtain a session key"`
ListenBrainz ListenBrainzConfig `toml:"listenbrainz" comment:"ListenBrainz scrobbling\ntoken found at: https://listenbrainz.org/profile/"`
// Lidarr integration
Lidarr LidarrConfig `` /* 155-byte string literal not displayed */
// Visualizer settings
Visualizer VisualizerConfig `toml:"visualizer" comment:"audio visualizer settings"`
// Desktop notifications
NotificationsEnabled bool `toml:"notifications_enabled" comment:"show desktop notifications on song changes (default: false)"`
NotificationsShowArt bool `toml:"notifications_show_art" comment:"include album art thumbnail in notifications (default: true)"`
// RP Auth (optional, enables ratings, comments, favorites sync, channel 99)
RPAuth RPAuthConfig `` /* 234-byte string literal not displayed */
// RP Favorites auto-download
AutoDownloadRPFavorites bool `` /* 253-byte string literal not displayed */
// RP auto-blocklist (blocks songs with low user ratings)
AutoBlocklistRPEnabled bool `` /* 208-byte string literal not displayed */
AutoBlocklistRPThreshold int `` /* 165-byte string literal not displayed */
// DJ segment skipping (SMAD detection)
SkipDJSegments bool `` /* 195-byte string literal not displayed */
DJConfidence float64 `toml:"dj_confidence" comment:"minimum confidence for speech detection (0.0-1.0, default: 0.88)"`
DJSafetyBuffer float64 `toml:"dj_safety_buffer" comment:"extra seconds to add after detected speech for safe skipping (default: 0.5)"`
DJMinSpeechDuration float64 `toml:"dj_min_speech_duration" comment:"minimum speech segment duration in seconds to count as DJ talk (default: 10.0)"`
// Layout mode
Layout string `` /* 271-byte string literal not displayed */
// Image protocol override (optional)
ForceProtocol string `` /* 234-byte string literal not displayed */
// Audio output
Audio AudioConfig `toml:"audio" comment:"audio output settings"`
// Jukebox mode
Jukebox JukeboxConfig `` /* 293-byte string literal not displayed */
// contains filtered or unexported fields
}
Config manages user configuration persistence
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with default values
func (*Config) GetBlocklistDir ¶
GetBlocklistDir returns the blocklist directory path
func (*Config) GetDisplayInfo ¶
GetDisplayInfo returns display string for current station/bitrate
func (*Config) GetFavoritesDir ¶
GetFavoritesDir returns the favorites directory path
type JukeboxConfig ¶
type JukeboxConfig struct {
MinFaves int `toml:"min_faves" comment:"minimum favorites required to enable jukebox mode (default: 20)"`
Repeat bool `toml:"repeat" comment:"reshuffle and repeat after playing all favorites (default: false)"`
CrossfadeDuration float64 `toml:"crossfade_duration" comment:"seconds for pseudo-crossfade volume ramp between songs, 0=disabled (default: 3.0)"`
}
JukeboxConfig holds jukebox mode settings
type LastFMConfig ¶
type LastFMConfig struct {
Enabled bool `toml:"enabled" comment:"enable Last.fm scrobbling (default: false)"`
SessionKey string `toml:"session_key" comment:"obtained via 'rptui --lastfm-auth' (default: '')"`
}
LastFMConfig holds Last.fm scrobble settings
type LidarrConfig ¶ added in v1.2.0
type LidarrConfig struct {
Enabled bool `toml:"enabled" comment:"enable Lidarr integration (default: false)"`
URL string `toml:"url" comment:"Lidarr base URL (e.g., http://localhost:8686)"`
APIKey string `toml:"api_key" comment:"Lidarr API key from Settings > General"`
}
LidarrConfig holds Lidarr integration settings
type ListenBrainzConfig ¶
type ListenBrainzConfig struct {
Enabled bool `toml:"enabled" comment:"enable ListenBrainz scrobbling (default: false)"`
Token string `toml:"token" comment:"user token from https://listenbrainz.org/profile/ (default: '')"`
}
ListenBrainzConfig holds ListenBrainz scrobble settings
type RPAuthConfig ¶
type RPAuthConfig struct {
Username string `toml:"username" comment:"RP account username"`
Password string `toml:"password" comment:"RP account password (used to obtain session token)"`
}
RPAuthConfig holds Radio Paradise account credentials (optional)
type StationIssue ¶
StationIssue represents a discrepancy between local config and RP API
func CheckStationIssues ¶
func CheckStationIssues(rpChannels map[int]string) []StationIssue
CheckStationIssues compares local StationNames against RP channel list. It returns issues for new, missing, or renamed stations.
type TerminalColors ¶ added in v1.1.0
type TerminalColors struct {
// contains filtered or unexported fields
}
type TerminalPaletteConfig ¶ added in v1.1.0
type TerminalPaletteConfig struct {
Cursor int `toml:"cursor" comment:"palette index for cursor color (0-15, default: 2 = green)"`
Accent int `toml:"accent" comment:"palette index for accent color (0-15, default: 4 = blue)"`
Muted int `toml:"muted" comment:"palette index for muted color (0-15, default: 8 = gray)"`
}
TerminalPaletteConfig holds palette indices for disable_theme mode
type ThemeStyles ¶
type ThemeStyles struct {
// Raw color values (for creating new styles)
Background string
Foreground string
Accent string
Muted string
Cursor string
// Special case progress bar background (only used for progress bar empty state)
// This is the ONLY place we ever use an explicit background color in transparent modes
ProgressBarBackground string
// Resolved hex color values (for widgets that don't support ANSI indices)
BackgroundHex string
ForegroundHex string
AccentHex string
MutedHex string
CursorHex string
// Pre-built styles
BackgroundStyle lipgloss.Style
ForegroundStyle lipgloss.Style
AccentStyle lipgloss.Style
MutedStyle lipgloss.Style
CursorStyle lipgloss.Style
Header lipgloss.Style
}
ThemeStyles contains parsed lipgloss styles for the application
func NewThemeStyles ¶
func NewThemeStyles(theme *ColorTheme, transparentBackground bool, disableTheme bool, terminalPalette TerminalPaletteConfig) *ThemeStyles
NewThemeStyles converts ColorTheme to lipgloss styles. If transparentBackground is true, uses terminal's default background. If disableTheme is true, uses terminal's default colors for everything. terminalPalette provides indices for cursor/accent/muted when disable_theme is true.
type ThemeWatcher ¶
type ThemeWatcher struct {
// contains filtered or unexported fields
}
func NewThemeWatcher ¶
func NewThemeWatcher(colorsFile string) *ThemeWatcher
func (*ThemeWatcher) Close ¶
func (tw *ThemeWatcher) Close()
func (*ThemeWatcher) Events ¶
func (tw *ThemeWatcher) Events() <-chan string
func (*ThemeWatcher) Start ¶
func (tw *ThemeWatcher) Start() error
type VisualizerConfig ¶
type VisualizerConfig struct {
Mode string `` /* 140-byte string literal not displayed */
ShowInfo string `toml:"show_info" comment:"song info overlay in fullscreen visualizer\nfade, on, off (default: fade)"`
InfoDuration int `toml:"info_duration" comment:"seconds to show song info overlay (default: 5)"`
RealAudio bool `` /* 168-byte string literal not displayed */
}
VisualizerConfig holds visualizer settings