diff --git a/README.md b/README.md index 63f95da..c059655 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ The GUI opens in your browser and lets you: - change the reminder interval - configure automatic refresh - choose the terminal used for installing updates +- manage settings in a dedicated dialog with tabs for general behavior, notifications, installation, and ignored packages +- disable reminders, keep install terminals open or let them close, and control confirmation for selective installs Selective package installs use `pacman -S --needed` or the configured AUR helper with `-S --needed`. On Arch, full system updates are still the safer default because partial upgrades can cause dependency mismatches. diff --git a/cmd/lazy-update-manager/main.go b/cmd/lazy-update-manager/main.go index c47311a..e3c9fe7 100644 --- a/cmd/lazy-update-manager/main.go +++ b/cmd/lazy-update-manager/main.go @@ -134,6 +134,9 @@ func notifyUpdates(args []string) int { if result.Total() == 0 { return 0 } + if !cfg.NotificationsEnabled { + return 0 + } store, err := state.Load(defaultStatePath()) if err != nil { diff --git a/internal/config/config.go b/internal/config/config.go index 977ae18..089bf44 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,22 +8,28 @@ import ( ) type Config struct { - CheckAUR bool `json:"check_aur"` - ReminderIntervalHours int `json:"reminder_interval_hours"` - Terminal string `json:"terminal"` - AutoRefreshMinutes int `json:"auto_refresh_minutes"` - ShowIgnored bool `json:"show_ignored"` - IgnoredPackages []string `json:"ignored_packages"` + CheckAUR bool `json:"check_aur"` + ReminderIntervalHours int `json:"reminder_interval_hours"` + Terminal string `json:"terminal"` + AutoRefreshMinutes int `json:"auto_refresh_minutes"` + ShowIgnored bool `json:"show_ignored"` + NotificationsEnabled bool `json:"notifications_enabled"` + KeepTerminalOpen bool `json:"keep_terminal_open"` + ConfirmSelectedInstalls bool `json:"confirm_selected_installs"` + IgnoredPackages []string `json:"ignored_packages"` } func Default() Config { return Config{ - CheckAUR: true, - ReminderIntervalHours: 168, - Terminal: "auto", - AutoRefreshMinutes: 30, - ShowIgnored: false, - IgnoredPackages: []string{}, + CheckAUR: true, + ReminderIntervalHours: 168, + Terminal: "auto", + AutoRefreshMinutes: 30, + ShowIgnored: false, + NotificationsEnabled: true, + KeepTerminalOpen: true, + ConfirmSelectedInstalls: true, + IgnoredPackages: []string{}, } } @@ -37,10 +43,25 @@ func Load(path string) (Config, error) { if err != nil { return cfg, err } + var raw map[string]json.RawMessage + if err := json.Unmarshal(data, &raw); err != nil { + return cfg, err + } if err := json.Unmarshal(data, &cfg); err != nil { return cfg, err } + defaults := Default() + if _, ok := raw["notifications_enabled"]; !ok { + cfg.NotificationsEnabled = defaults.NotificationsEnabled + } + if _, ok := raw["keep_terminal_open"]; !ok { + cfg.KeepTerminalOpen = defaults.KeepTerminalOpen + } + if _, ok := raw["confirm_selected_installs"]; !ok { + cfg.ConfirmSelectedInstalls = defaults.ConfirmSelectedInstalls + } + cfg = normalize(cfg) return cfg, nil } diff --git a/internal/gui/assets.go b/internal/gui/assets.go index cadc542..8fd5538 100644 --- a/internal/gui/assets.go +++ b/internal/gui/assets.go @@ -16,6 +16,7 @@ const indexHTML = `
Pruefe Updates...