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 <noreply@anthropic.com>
This commit is contained in:
maxsoch 2026-07-06 22:05:53 +02:00
parent 617e07d53d
commit bd19bee52e
2 changed files with 18 additions and 1 deletions

View file

@ -245,7 +245,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func fetchOutdated() { func fetchOutdated() {
setMenuBarIcon("brewbar-updating") 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) let lines = BrewParser.parseOutdated(output)
self.cachedOutdated = lines self.cachedOutdated = lines

View file

@ -15,6 +15,7 @@ class SettingsWindowController: NSWindowController {
var intervalPopup: NSPopUpButton! var intervalPopup: NSPopUpButton!
var customMinutesField: NSTextField! var customMinutesField: NSTextField!
var launchAtLoginCheckbox: NSButton! var launchAtLoginCheckbox: NSButton!
var greedyCheckbox: NSButton!
convenience init(appDelegate: AppDelegate) { convenience init(appDelegate: AppDelegate) {
let window = NSWindow( let window = NSWindow(
@ -74,9 +75,16 @@ class SettingsWindowController: NSWindowController {
action: #selector(toggleLaunchAtLogin(_:)) action: #selector(toggleLaunchAtLogin(_:))
) )
greedyCheckbox = NSButton(
checkboxWithTitle: "Include self-updating casks (--greedy)",
target: self,
action: #selector(toggleGreedy(_:))
)
let stack = NSStackView(views: [ let stack = NSStackView(views: [
frequencyRow, frequencyRow,
customRow, customRow,
greedyCheckbox,
separator(), separator(),
launchAtLoginCheckbox, launchAtLoginCheckbox,
]) ])
@ -113,6 +121,7 @@ class SettingsWindowController: NSWindowController {
// SMAppService is the source of truth the user may have changed // SMAppService is the source of truth the user may have changed
// this in System Settings > Login Items while we weren't looking // this in System Settings > Login Items while we weren't looking
launchAtLoginCheckbox.state = SMAppService.mainApp.status == .enabled ? .on : .off launchAtLoginCheckbox.state = SMAppService.mainApp.status == .enabled ? .on : .off
greedyCheckbox.state = Settings.includeGreedyCasks ? .on : .off
} }
func separator() -> NSBox { func separator() -> NSBox {
@ -145,6 +154,11 @@ class SettingsWindowController: NSWindowController {
syncUI() syncUI()
} }
@objc func toggleGreedy(_ sender: NSButton) {
Settings.includeGreedyCasks = sender.state == .on
appDelegate?.fetchOutdated() // the list contents just changed meaning
}
@objc func toggleLaunchAtLogin(_ sender: NSButton) { @objc func toggleLaunchAtLogin(_ sender: NSButton) {
do { do {
if sender.state == .on { if sender.state == .on {