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 GetFilterCacheDir() (string, error)
- func GetFilterCacheFile() (string, error)
- func GetLogDir() (string, error)
- func GetStateDir() (string, error)
- func Init() error
- func OnConfigChange(callback func(*Config))
- func Watch() error
- type APISecurityConfig
- type AppearanceConfig
- type CodecConfig
- type ColorPalette
- type Config
- type DatabaseConfig
- type DebugConfig
- type DmenuConfig
- type HistoryConfig
- type LoggingConfig
- type Manager
- type PaneModeConfig
- type PopupBehavior
- type PopupBehaviorConfig
- type RenderingMode
- type SearchShortcut
- type TabKeyConfig
- type VideoAccelerationConfig
- type WebkitMemoryConfig
- type WorkspaceConfig
- type WorkspaceStylingConfig
- 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 GetFilterCacheDir ¶ added in v0.7.0
GetFilterCacheDir returns the XDG-compliant filter cache directory for dumber. Filter cache is stored in XDG_STATE_HOME as it's transient data that can be regenerated.
func GetFilterCacheFile ¶ added in v0.7.0
GetFilterCacheFile returns the path to the main filter cache file.
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 APISecurityConfig ¶ added in v0.8.0
type APISecurityConfig struct {
// If non-empty, token that requests must present via `token` query param
Token string `mapstructure:"token" yaml:"token"`
// If true, require token for all API endpoints (except a minimal allowlist)
RequireToken bool `mapstructure:"require_token" yaml:"require_token"`
}
APISecurityConfig holds optional API key protection for dumb://api endpoints
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"`
LightPalette ColorPalette `mapstructure:"light_palette" yaml:"light_palette"`
DarkPalette ColorPalette `mapstructure:"dark_palette" yaml:"dark_palette"`
}
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 ColorPalette ¶ added in v0.11.0
type ColorPalette struct {
Background string `mapstructure:"background" yaml:"background" json:"background"`
Surface string `mapstructure:"surface" yaml:"surface" json:"surface"`
SurfaceVariant string `mapstructure:"surface_variant" yaml:"surface_variant" json:"surface_variant"`
Text string `mapstructure:"text" yaml:"text" json:"text"`
Muted string `mapstructure:"muted" yaml:"muted" json:"muted"`
Accent string `mapstructure:"accent" yaml:"accent" json:"accent"`
Border string `mapstructure:"border" yaml:"border" json:"border"`
}
ColorPalette contains semantic color tokens for light/dark themes.
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"`
WebkitMemory WebkitMemoryConfig `mapstructure:"webkit_memory" yaml:"webkit_memory"`
Debug DebugConfig `mapstructure:"debug" yaml:"debug"`
APISecurity APISecurityConfig `mapstructure:"api_security" yaml:"api_security"`
// RenderingMode controls GPU/CPU rendering selection for WebKit
RenderingMode RenderingMode `mapstructure:"rendering_mode" yaml:"rendering_mode"`
// UseDomZoom toggles DOM-based zoom instead of native WebKit zoom.
UseDomZoom bool `mapstructure:"use_dom_zoom" yaml:"use_dom_zoom"`
// DefaultZoom sets the default zoom level for pages without saved zoom settings (1.0 = 100%, 1.2 = 120%)
DefaultZoom float64 `mapstructure:"default_zoom" yaml:"default_zoom"`
// Workspace defines workspace, pane, and tab handling behaviour.
Workspace WorkspaceConfig `mapstructure:"workspace" yaml:"workspace"`
// ContentFilteringWhitelist domains skip ad blocking (e.g. Twitch breaks with bot detection)
ContentFilteringWhitelist []string `mapstructure:"content_filtering_whitelist" yaml:"content_filtering_whitelist"`
}
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 DebugConfig ¶ added in v0.7.0
type DebugConfig struct {
// Enable WebKit internal debug logging
EnableWebKitDebug bool `mapstructure:"enable_webkit_debug" yaml:"enable_webkit_debug"`
// WebKit debug categories (comma-separated)
// Common values: "Network:preconnectTo", "ContentFilters", "Loading", "JavaScript"
WebKitDebugCategories string `mapstructure:"webkit_debug_categories" yaml:"webkit_debug_categories"`
// Enable content filtering debug logs
EnableFilteringDebug bool `mapstructure:"enable_filtering_debug" yaml:"enable_filtering_debug"`
// Enable detailed WebView state logging
EnableWebViewDebug bool `mapstructure:"enable_webview_debug" yaml:"enable_webview_debug"`
// Log WebKit crashes and errors to file
LogWebKitCrashes bool `mapstructure:"log_webkit_crashes" yaml:"log_webkit_crashes"`
// Enable script injection debug logs
EnableScriptDebug bool `mapstructure:"enable_script_debug" yaml:"enable_script_debug"`
// Enable general debug mode (equivalent to DUMBER_DEBUG env var)
EnableGeneralDebug bool `mapstructure:"enable_general_debug" yaml:"enable_general_debug"`
// Enable workspace navigation and focus debug logs
EnableWorkspaceDebug bool `mapstructure:"enable_workspace_debug" yaml:"enable_workspace_debug"`
// Enable focus state machine debug logs
EnableFocusDebug bool `mapstructure:"enable_focus_debug" yaml:"enable_focus_debug"`
// Enable CSS reconciler debug logs
EnableCSSDebug bool `mapstructure:"enable_css_debug" yaml:"enable_css_debug"`
// Enable focus metrics tracking
EnableFocusMetrics bool `mapstructure:"enable_focus_metrics" yaml:"enable_focus_metrics"`
// Enable detailed pane close instrumentation and tree snapshots
EnablePaneCloseDebug bool `mapstructure:"enable_pane_close_debug" yaml:"enable_pane_close_debug"`
}
DebugConfig holds debug and troubleshooting options
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" json:"capture_stdout"`
CaptureStderr bool `mapstructure:"capture_stderr" yaml:"capture_stderr" json:"capture_stderr"`
CaptureCOutput bool `mapstructure:"capture_c_output" yaml:"capture_c_output" json:"capture_c_output"`
CaptureConsole bool `mapstructure:"capture_console" yaml:"capture_console" json:"capture_console"`
// 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 PaneModeConfig ¶ added in v0.9.0
type PaneModeConfig struct {
ActivationShortcut string `mapstructure:"activation_shortcut" yaml:"activation_shortcut" json:"activation_shortcut"`
TimeoutMilliseconds int `mapstructure:"timeout_ms" yaml:"timeout_ms" json:"timeout_ms"`
ActionBindings map[string]string `mapstructure:"action_bindings" yaml:"action_bindings" json:"action_bindings"`
}
PaneModeConfig defines modal behaviour for pane management.
type PopupBehavior ¶ added in v0.12.0
type PopupBehavior string
PopupBehavior defines how popup windows should be opened
const ( // PopupBehaviorSplit opens popups in a split pane (default) PopupBehaviorSplit PopupBehavior = "split" // PopupBehaviorStacked opens popups in a stacked pane PopupBehaviorStacked PopupBehavior = "stacked" // PopupBehaviorTabbed opens popups as a new tab PopupBehaviorTabbed PopupBehavior = "tabbed" // PopupBehaviorWindowed opens popups in a new workspace window PopupBehaviorWindowed PopupBehavior = "windowed" )
type PopupBehaviorConfig ¶ added in v0.9.0
type PopupBehaviorConfig struct {
// Behavior determines how popups are opened (split/stacked/tabbed/windowed)
Behavior PopupBehavior `mapstructure:"behavior" yaml:"behavior" json:"behavior"`
// Placement specifies direction for split behavior ("right", "left", "top", "bottom")
// Only used when Behavior is "split"
Placement string `mapstructure:"placement" yaml:"placement" json:"placement"`
// OpenInNewPane controls whether popups are opened in workspace or blocked
OpenInNewPane bool `mapstructure:"open_in_new_pane" yaml:"open_in_new_pane" json:"open_in_new_pane"`
// FollowPaneContext determines if popup placement follows parent pane context
FollowPaneContext bool `mapstructure:"follow_pane_context" yaml:"follow_pane_context" json:"follow_pane_context"`
// BlankTargetBehavior determines how to handle window.open(url, "_blank") intents
// Accepted values: "pane" (default) or "tab" (future support)
BlankTargetBehavior string `mapstructure:"blank_target_behavior" yaml:"blank_target_behavior" json:"blank_target_behavior"`
// EnableSmartDetection uses WebKitWindowProperties to detect popup vs tab intents
EnableSmartDetection bool `mapstructure:"enable_smart_detection" yaml:"enable_smart_detection" json:"enable_smart_detection"`
// OAuthAutoClose enables auto-closing OAuth popups after successful auth redirects
OAuthAutoClose bool `mapstructure:"oauth_auto_close" yaml:"oauth_auto_close" json:"oauth_auto_close"`
}
PopupBehaviorConfig defines handling for popup windows.
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 TabKeyConfig ¶ added in v0.9.0
type TabKeyConfig struct {
NewTab string `mapstructure:"new_tab" yaml:"new_tab" json:"new_tab"`
CloseTab string `mapstructure:"close_tab" yaml:"close_tab" json:"close_tab"`
NextTab string `mapstructure:"next_tab" yaml:"next_tab" json:"next_tab"`
PreviousTab string `mapstructure:"previous_tab" yaml:"previous_tab" json:"previous_tab"`
}
TabKeyConfig defines Zellij-inspired tab shortcuts.
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 WebkitMemoryConfig ¶ added in v0.7.0
type WebkitMemoryConfig struct {
// Cache model (document_viewer | web_browser | primary_web_browser)
CacheModel string `mapstructure:"cache_model" yaml:"cache_model"`
// Enable page cache for back/forward navigation
EnablePageCache bool `mapstructure:"enable_page_cache" yaml:"enable_page_cache"`
// Memory limit in MB (0 = system default)
MemoryLimitMB int `mapstructure:"memory_limit_mb" yaml:"memory_limit_mb"`
// Memory pressure thresholds (0.0-1.0)
ConservativeThreshold float64 `mapstructure:"conservative_threshold" yaml:"conservative_threshold"`
StrictThreshold float64 `mapstructure:"strict_threshold" yaml:"strict_threshold"`
KillThreshold float64 `mapstructure:"kill_threshold" yaml:"kill_threshold"`
// Memory monitoring interval in seconds
PollIntervalSeconds float64 `mapstructure:"poll_interval_seconds" yaml:"poll_interval_seconds"`
// Garbage collection interval in seconds (0 = disabled)
EnableGCInterval int `mapstructure:"enable_gc_interval" yaml:"enable_gc_interval"`
// Process recycling threshold (number of page loads)
ProcessRecycleThreshold int `mapstructure:"process_recycle_threshold" yaml:"process_recycle_threshold"`
// Enable memory monitoring logs
EnableMemoryMonitoring bool `mapstructure:"enable_memory_monitoring" yaml:"enable_memory_monitoring"`
}
WebkitMemoryConfig holds WebKit memory optimization settings
type WorkspaceConfig ¶ added in v0.9.0
type WorkspaceConfig struct {
// EnableZellijControls toggles Zellij-inspired keybindings.
EnableZellijControls bool `mapstructure:"enable_zellij_controls" yaml:"enable_zellij_controls" json:"enable_zellij_controls"`
// PaneMode defines modal pane behaviour and bindings.
PaneMode PaneModeConfig `mapstructure:"pane_mode" yaml:"pane_mode" json:"pane_mode"`
// Tabs holds classic browser tab shortcuts.
Tabs TabKeyConfig `mapstructure:"tabs" yaml:"tabs" json:"tabs"`
// Popups configures default popup placement rules.
Popups PopupBehaviorConfig `mapstructure:"popups" yaml:"popups" json:"popups"`
// Styling configures workspace visual appearance.
Styling WorkspaceStylingConfig `mapstructure:"styling" yaml:"styling" json:"styling"`
}
WorkspaceConfig captures layout, pane, and tab behaviour preferences.
type WorkspaceStylingConfig ¶ added in v0.9.0
type WorkspaceStylingConfig struct {
// BorderWidth in pixels for pane borders
BorderWidth int `mapstructure:"border_width" yaml:"border_width" json:"border_width"`
// BorderColor for focused panes (CSS color value or theme variable)
BorderColor string `mapstructure:"border_color" yaml:"border_color" json:"border_color"`
// PaneModeBorderColor for the pane mode indicator border (CSS color value or theme variable)
// Defaults to "#FFA500" (orange) if not set
PaneModeBorderColor string `mapstructure:"pane_mode_border_color" yaml:"pane_mode_border_color" json:"pane_mode_border_color"`
// TransitionDuration in milliseconds for border animations
TransitionDuration int `mapstructure:"transition_duration" yaml:"transition_duration" json:"transition_duration"`
// BorderRadius in pixels for pane border corners
BorderRadius int `mapstructure:"border_radius" yaml:"border_radius" json:"border_radius"`
}
WorkspaceStylingConfig defines visual styling for workspace panes.
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)