From bd19bee52e23ff1d95db4c071c5f460a79b60e0a Mon Sep 17 00:00:00 2001 From: maxsoch Date: Mon, 6 Jul 2026 22:05:53 +0200 Subject: [PATCH] add setting to include self-updating casks (--greedy), on by default brew outdated normally skips casks that auto-update themselves; with includeGreedyCasks enabled (the default) BrewBar passes --greedy so they show up too. Toggling the checkbox refetches immediately since the list semantics change. Co-Authored-By: Claude Fable 5 --- BrewBar/BrewBarApp.swift | 5 ++++- BrewBar/SettingsWindowController.swift | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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 {