diff --git a/BrewBar/BrewBarApp.swift b/BrewBar/BrewBarApp.swift index d7b4533..f102df3 100644 --- a/BrewBar/BrewBarApp.swift +++ b/BrewBar/BrewBarApp.swift @@ -245,7 +245,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { func fetchOutdated() { setMenuBarIcon("brewbar-updating") - runBrew("outdated") { output in + // --greedy also lists casks that self-update (brew skips them by default) + let command = Settings.includeGreedyCasks ? "outdated --greedy" : "outdated" + + runBrew(command) { output in let lines = BrewParser.parseOutdated(output) self.cachedOutdated = lines diff --git a/BrewBar/SettingsWindowController.swift b/BrewBar/SettingsWindowController.swift index ef962c7..bae5c85 100644 --- a/BrewBar/SettingsWindowController.swift +++ b/BrewBar/SettingsWindowController.swift @@ -15,6 +15,7 @@ class SettingsWindowController: NSWindowController { var intervalPopup: NSPopUpButton! var customMinutesField: NSTextField! var launchAtLoginCheckbox: NSButton! + var greedyCheckbox: NSButton! convenience init(appDelegate: AppDelegate) { let window = NSWindow( @@ -74,9 +75,16 @@ class SettingsWindowController: NSWindowController { action: #selector(toggleLaunchAtLogin(_:)) ) + greedyCheckbox = NSButton( + checkboxWithTitle: "Include self-updating casks (--greedy)", + target: self, + action: #selector(toggleGreedy(_:)) + ) + let stack = NSStackView(views: [ frequencyRow, customRow, + greedyCheckbox, separator(), launchAtLoginCheckbox, ]) @@ -113,6 +121,7 @@ class SettingsWindowController: NSWindowController { // SMAppService is the source of truth — the user may have changed // this in System Settings > Login Items while we weren't looking launchAtLoginCheckbox.state = SMAppService.mainApp.status == .enabled ? .on : .off + greedyCheckbox.state = Settings.includeGreedyCasks ? .on : .off } func separator() -> NSBox { @@ -145,6 +154,11 @@ class SettingsWindowController: NSWindowController { syncUI() } + @objc func toggleGreedy(_ sender: NSButton) { + Settings.includeGreedyCasks = sender.state == .on + appDelegate?.fetchOutdated() // the list contents just changed meaning + } + @objc func toggleLaunchAtLogin(_ sender: NSButton) { do { if sender.state == .on {