feat(config): add downloads configuration
- commit
- f5ba6361f4efe7d63a547fb0d1b946f8cab490fe
- author
- brice · · 2026-01-07 09:54 UTC
- parent
- 47ccc89
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +17 -0
M internal/infrastructure/config/defaults.go +3 -0
| @@ -311,6 +311,9 @@ func DefaultConfig() *Config { | |||
| 311 | 311 | AutoDownload: false, // Conservative: don't auto-download by default | |
| 312 | 312 | NotifyOnNewSettings: true, // Show toast when new config settings available | |
| 313 | 313 | }, | |
| 314 | + | Downloads: DownloadsConfig{ | |
| 315 | + | Path: "", // Empty = use XDG_DOWNLOAD_DIR or ~/Downloads | |
| 316 | + | }, | |
| 314 | 317 | } | |
| 315 | 318 | } | |
| 316 | 319 | ||
| @@ -311,6 +311,9 @@ func DefaultConfig() *Config { | |||||
| 311 | AutoDownload: false, // Conservative: don't auto-download by default | 311 | AutoDownload: false, // Conservative: don't auto-download by default | ||
| 312 | NotifyOnNewSettings: true, // Show toast when new config settings available | 312 | NotifyOnNewSettings: true, // Show toast when new config settings available | ||
| 313 | }, | 313 | }, | ||
| 314 | + | Downloads: DownloadsConfig{ | |||
| 315 | + | Path: "", // Empty = use XDG_DOWNLOAD_DIR or ~/Downloads | |||
| 316 | + | }, | |||
| 314 | } | 317 | } | ||
| 315 | } | 318 | } | ||
| 316 | 319 | ||||
M internal/infrastructure/config/loader.go +5 -0
| @@ -365,6 +365,7 @@ func (m *Manager) setDefaults() { | |||
| 365 | 365 | m.setSessionDefaults(defaults) | |
| 366 | 366 | m.setUpdateDefaults(defaults) | |
| 367 | 367 | m.setPerformanceDefaults(defaults) | |
| 368 | + | m.setDownloadsDefaults(defaults) | |
| 368 | 369 | } | |
| 369 | 370 | ||
| 370 | 371 | func (m *Manager) setHistoryDefaults(defaults *Config) { | |
| @@ -533,6 +534,10 @@ func (m *Manager) setPerformanceDefaults(defaults *Config) { | |||
| 533 | 534 | m.viper.SetDefault("performance.network_process_memory_strict_threshold", defaults.Performance.NetworkProcessMemoryStrictThreshold) | |
| 534 | 535 | } | |
| 535 | 536 | ||
| 537 | + | func (m *Manager) setDownloadsDefaults(defaults *Config) { | |
| 538 | + | m.viper.SetDefault("downloads.path", defaults.Downloads.Path) | |
| 539 | + | } | |
| 540 | + | ||
| 536 | 541 | // New returns a new default configuration instance. | |
| 537 | 542 | // This is a convenience function for getting default config without the full manager. | |
| 538 | 543 | func New() *Config { | |
| @@ -365,6 +365,7 @@ func (m *Manager) setDefaults() { | |||||
| 365 | m.setSessionDefaults(defaults) | 365 | m.setSessionDefaults(defaults) | ||
| 366 | m.setUpdateDefaults(defaults) | 366 | m.setUpdateDefaults(defaults) | ||
| 367 | m.setPerformanceDefaults(defaults) | 367 | m.setPerformanceDefaults(defaults) | ||
| 368 | + | m.setDownloadsDefaults(defaults) | |||
| 368 | } | 369 | } | ||
| 369 | 370 | ||||
| 370 | func (m *Manager) setHistoryDefaults(defaults *Config) { | 371 | func (m *Manager) setHistoryDefaults(defaults *Config) { | ||
| @@ -533,6 +534,10 @@ func (m *Manager) setPerformanceDefaults(defaults *Config) { | |||||
| 533 | m.viper.SetDefault("performance.network_process_memory_strict_threshold", defaults.Performance.NetworkProcessMemoryStrictThreshold) | 534 | m.viper.SetDefault("performance.network_process_memory_strict_threshold", defaults.Performance.NetworkProcessMemoryStrictThreshold) | ||
| 534 | } | 535 | } | ||
| 535 | 536 | ||||
| 537 | + | func (m *Manager) setDownloadsDefaults(defaults *Config) { | |||
| 538 | + | m.viper.SetDefault("downloads.path", defaults.Downloads.Path) | |||
| 539 | + | } | |||
| 540 | + | ||||
| 536 | // New returns a new default configuration instance. | 541 | // New returns a new default configuration instance. | ||
| 537 | // This is a convenience function for getting default config without the full manager. | 542 | // This is a convenience function for getting default config without the full manager. | ||
| 538 | func New() *Config { | 543 | func New() *Config { | ||
M internal/infrastructure/config/schema.go +9 -0
| @@ -35,6 +35,8 @@ type Config struct { | |||
| 35 | 35 | Performance PerformanceConfig `mapstructure:"performance" yaml:"performance" toml:"performance"` | |
| 36 | 36 | // Update controls automatic update checking and downloading. | |
| 37 | 37 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | |
| 38 | + | // Downloads configures file download behavior. | |
| 39 | + | Downloads DownloadsConfig `mapstructure:"downloads" yaml:"downloads" toml:"downloads"` | |
| 38 | 40 | } | |
| 39 | 41 | ||
| 40 | 42 | // RenderingMode selects GPU vs CPU rendering. | |
| @@ -372,6 +374,13 @@ type UpdateConfig struct { | |||
| 372 | 374 | NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"` | |
| 373 | 375 | } | |
| 374 | 376 | ||
| 377 | + | // DownloadsConfig holds file download preferences. | |
| 378 | + | type DownloadsConfig struct { | |
| 379 | + | // Path is the directory where downloads are saved. | |
| 380 | + | // Empty string means use XDG_DOWNLOAD_DIR or ~/Downloads. | |
| 381 | + | Path string `mapstructure:"path" yaml:"path" toml:"path"` | |
| 382 | + | } | |
| 383 | + | ||
| 375 | 384 | // WorkspaceConfig captures layout, pane, and tab behavior preferences. | |
| 376 | 385 | type WorkspaceConfig struct { | |
| 377 | 386 | // NewPaneURL is the URL loaded when creating a new empty pane/tab. | |
| @@ -35,6 +35,8 @@ type Config struct { | |||||
| 35 | Performance PerformanceConfig `mapstructure:"performance" yaml:"performance" toml:"performance"` | 35 | Performance PerformanceConfig `mapstructure:"performance" yaml:"performance" toml:"performance"` | ||
| 36 | // Update controls automatic update checking and downloading. | 36 | // Update controls automatic update checking and downloading. | ||
| 37 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | 37 | Update UpdateConfig `mapstructure:"update" yaml:"update" toml:"update"` | ||
| 38 | + | // Downloads configures file download behavior. | |||
| 39 | + | Downloads DownloadsConfig `mapstructure:"downloads" yaml:"downloads" toml:"downloads"` | |||
| 38 | } | 40 | } | ||
| 39 | 41 | ||||
| 40 | // RenderingMode selects GPU vs CPU rendering. | 42 | // RenderingMode selects GPU vs CPU rendering. | ||
| @@ -372,6 +374,13 @@ type UpdateConfig struct { | |||||
| 372 | NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"` | 374 | NotifyOnNewSettings bool `mapstructure:"notify_on_new_settings" yaml:"notify_on_new_settings" toml:"notify_on_new_settings"` | ||
| 373 | } | 375 | } | ||
| 374 | 376 | ||||
| 377 | + | // DownloadsConfig holds file download preferences. | |||
| 378 | + | type DownloadsConfig struct { | |||
| 379 | + | // Path is the directory where downloads are saved. | |||
| 380 | + | // Empty string means use XDG_DOWNLOAD_DIR or ~/Downloads. | |||
| 381 | + | Path string `mapstructure:"path" yaml:"path" toml:"path"` | |||
| 382 | + | } | |||
| 383 | + | ||||
| 375 | // WorkspaceConfig captures layout, pane, and tab behavior preferences. | 384 | // WorkspaceConfig captures layout, pane, and tab behavior preferences. | ||
| 376 | type WorkspaceConfig struct { | 385 | type WorkspaceConfig struct { | ||
| 377 | // NewPaneURL is the URL loaded when creating a new empty pane/tab. | 386 | // NewPaneURL is the URL loaded when creating a new empty pane/tab. | ||