Documentation
¶
Overview ¶
Package config provides configuration management for dumber with Viper integration.
Package config provides default configuration values for dumber.
Package config provides XDG Base Directory specification compliance utilities.
Index ¶
- func EnsureDirectories() error
- func GetConfigDir() (string, error)
- func GetConfigFile() (string, error)
- func GetDataDir() (string, error)
- func GetDatabaseFile() (string, error)
- func GetDefaultSearchShortcuts() map[string]SearchShortcut
- func GetLogDir() (string, error)
- func GetStateDir() (string, error)
- func Init() error
- func OnConfigChange(callback func(*Config))
- func Watch() error
- type AppearanceConfig
- type CodecConfig
- type Config
- type DatabaseConfig
- type DmenuConfig
- type HistoryConfig
- type LoggingConfig
- type Manager
- type RenderingMode
- type SearchShortcut
- type VideoAccelerationConfig
- type XDGDirs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDirectories ¶
func EnsureDirectories() error
EnsureDirectories creates the XDG directories if they don't exist.
func GetConfigDir ¶
GetConfigDir returns the XDG config directory for dumber.
func GetConfigFile ¶
GetConfigFile returns the path to the main configuration file.
func GetDataDir ¶
GetDataDir returns the XDG data directory for dumber.
func GetDatabaseFile ¶
GetDatabaseFile returns the path to the database file in the state directory.
func GetDefaultSearchShortcuts ¶
func GetDefaultSearchShortcuts() map[string]SearchShortcut
GetDefaultSearchShortcuts returns the default search shortcuts.
func GetLogDir ¶ added in v0.5.0
GetLogDir returns the XDG-compliant log directory for dumber. Logs are stored in XDG_STATE_HOME as per specification.
func GetStateDir ¶
GetStateDir returns the XDG state directory for dumber.
func OnConfigChange ¶
func OnConfigChange(callback func(*Config))
OnConfigChange registers a callback for global configuration changes.
Types ¶
type AppearanceConfig ¶
type AppearanceConfig struct {
// Default fonts for pages that do not specify fonts.
SansFont string `mapstructure:"sans_font" yaml:"sans_font"`
SerifFont string `mapstructure:"serif_font" yaml:"serif_font"`
MonospaceFont string `mapstructure:"monospace_font" yaml:"monospace_font"`
// Default font size in CSS pixels (approx).
DefaultFontSize int `mapstructure:"default_font_size" yaml:"default_font_size"`
}
AppearanceConfig holds UI/rendering preferences.
type CodecConfig ¶ added in v0.6.0
type CodecConfig struct {
// Codec preference order (e.g., "av1,h264,vp8")
PreferredCodecs string `mapstructure:"preferred_codecs" yaml:"preferred_codecs"`
// Force specific codec for platforms
ForceAV1 bool `mapstructure:"force_av1" yaml:"force_av1"`
// Block problematic codecs
BlockVP9 bool `mapstructure:"block_vp9" yaml:"block_vp9"`
BlockVP8 bool `mapstructure:"block_vp8" yaml:"block_vp8"`
// Hardware acceleration per codec
AV1HardwareOnly bool `mapstructure:"av1_hardware_only" yaml:"av1_hardware_only"`
DisableVP9Hardware bool `mapstructure:"disable_vp9_hardware" yaml:"disable_vp9_hardware"`
// Buffer configuration for smooth playback
VideoBufferSizeMB int `mapstructure:"video_buffer_size_mb" yaml:"video_buffer_size_mb"`
QueueBufferTimeSec int `mapstructure:"queue_buffer_time_sec" yaml:"queue_buffer_time_sec"`
// Custom User-Agent for codec negotiation
CustomUserAgent string `mapstructure:"custom_user_agent" yaml:"custom_user_agent"`
// Maximum resolution for AV1 codec (720p, 1080p, 1440p, 4k, unlimited)
AV1MaxResolution string `mapstructure:"av1_max_resolution" yaml:"av1_max_resolution"`
// Site-specific codec control settings
DisableTwitchCodecControl bool `mapstructure:"disable_twitch_codec_control" yaml:"disable_twitch_codec_control"`
}
CodecConfig holds video codec preferences and handling
type Config ¶
type Config struct {
Database DatabaseConfig `mapstructure:"database" yaml:"database"`
History HistoryConfig `mapstructure:"history" yaml:"history"`
SearchShortcuts map[string]SearchShortcut `mapstructure:"search_shortcuts" yaml:"search_shortcuts"`
Logging LoggingConfig `mapstructure:"logging" yaml:"logging"`
Appearance AppearanceConfig `mapstructure:"appearance" yaml:"appearance"`
VideoAcceleration VideoAccelerationConfig `mapstructure:"video_acceleration" yaml:"video_acceleration"`
CodecPreferences CodecConfig `mapstructure:"codec_preferences" yaml:"codec_preferences"`
// RenderingMode controls GPU/CPU rendering selection for WebKit
RenderingMode RenderingMode `mapstructure:"rendering_mode" yaml:"rendering_mode"`
}
Config represents the complete configuration for dumber.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration values for dumber.
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `mapstructure:"path" yaml:"path"`
MaxConnections int `mapstructure:"max_connections" yaml:"max_connections"`
MaxIdleTime time.Duration `mapstructure:"max_idle_time" yaml:"max_idle_time"`
QueryTimeout time.Duration `mapstructure:"query_timeout" yaml:"query_timeout"`
}
DatabaseConfig holds database-related configuration.
type DmenuConfig ¶
type DmenuConfig struct {
}
DmenuConfig holds dmenu/rofi integration configuration.
type HistoryConfig ¶
type HistoryConfig struct {
MaxEntries int `mapstructure:"max_entries" yaml:"max_entries"`
RetentionPeriodDays int `mapstructure:"retention_period_days" yaml:"retention_period_days"`
CleanupIntervalDays int `mapstructure:"cleanup_interval_days" yaml:"cleanup_interval_days"`
}
HistoryConfig holds history-related configuration.
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level" yaml:"level"`
Format string `mapstructure:"format" yaml:"format"`
Filename string `mapstructure:"filename" yaml:"filename"`
MaxSize int `mapstructure:"max_size" yaml:"max_size"`
MaxBackups int `mapstructure:"max_backups" yaml:"max_backups"`
MaxAge int `mapstructure:"max_age" yaml:"max_age"`
Compress bool `mapstructure:"compress" yaml:"compress"`
// File output configuration
LogDir string `mapstructure:"log_dir" yaml:"log_dir"`
EnableFileLog bool `mapstructure:"enable_file_log" yaml:"enable_file_log"`
// Capture settings
CaptureStdout bool `mapstructure:"capture_stdout" yaml:"capture_stdout"`
CaptureStderr bool `mapstructure:"capture_stderr" yaml:"capture_stderr"`
CaptureCOutput bool `mapstructure:"capture_c_output" yaml:"capture_c_output"`
// Debug output
DebugFile string `mapstructure:"debug_file" yaml:"debug_file"`
VerboseWebKit bool `mapstructure:"verbose_webkit" yaml:"verbose_webkit"`
}
LoggingConfig holds logging configuration.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles configuration loading, watching, and reloading.
func NewManager ¶
NewManager creates a new configuration manager.
func (*Manager) GetConfigFile ¶
GetConfigFile returns the path to the configuration file being used.
func (*Manager) OnConfigChange ¶
OnConfigChange registers a callback function to be called when config changes.
type RenderingMode ¶
type RenderingMode string
RenderingMode selects GPU vs CPU rendering.
const ( RenderingModeAuto RenderingMode = "auto" RenderingModeGPU RenderingMode = "gpu" RenderingModeCPU RenderingMode = "cpu" )
type SearchShortcut ¶
type SearchShortcut struct {
URL string `mapstructure:"url" yaml:"url" json:"url"`
Description string `mapstructure:"description" yaml:"description" json:"description"`
}
SearchShortcut represents a search shortcut configuration.
type VideoAccelerationConfig ¶ added in v0.5.0
type VideoAccelerationConfig struct {
EnableVAAPI bool `mapstructure:"enable_vaapi" yaml:"enable_vaapi"`
AutoDetectGPU bool `mapstructure:"auto_detect_gpu" yaml:"auto_detect_gpu"`
VAAPIDriverName string `mapstructure:"vaapi_driver_name" yaml:"vaapi_driver_name"`
EnableAllDrivers bool `mapstructure:"enable_all_drivers" yaml:"enable_all_drivers"`
LegacyVAAPI bool `mapstructure:"legacy_vaapi" yaml:"legacy_vaapi"`
}
VideoAccelerationConfig holds video hardware acceleration preferences.
type XDGDirs ¶
XDGDirs holds the XDG Base Directory paths for the application.
func GetXDGDirs ¶
GetXDGDirs returns the XDG Base Directory paths for dumber. It follows the XDG Base Directory specification: - $XDG_CONFIG_HOME/dumber (default: ~/.config/dumber) - $XDG_DATA_HOME/dumber (default: ~/.local/share/dumber) - $XDG_STATE_HOME/dumber (default: ~/.local/state/dumber)