explain the greedy setting in the settings window

Add a note under the greedy checkbox spelling out what self-updating
casks are and that the setting affects both the outdated listing and
upgrades (Upgrade All and auto-upgrade). The indented-gray-note layout
is extracted into a noteRow helper, now shared with the cask warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
maxsoch 2026-07-06 22:18:23 +02:00
parent 741f9572b7
commit 3a5a7ee623

View file

@ -87,6 +87,10 @@ class SettingsWindowController: NSWindowController {
action: #selector(toggleGreedy(_:)) action: #selector(toggleGreedy(_:))
) )
let greedyNote = noteRow(
"Some apps (Chrome, Firefox…) update themselves, so Homebrew normally ignores them. When enabled, BrewBar also lists them as outdated and includes them in Upgrade All and auto-upgrades."
)
autoUpgradeFormulaeCheckbox = NSButton( autoUpgradeFormulaeCheckbox = NSButton(
checkboxWithTitle: "Automatically upgrade formulae (command-line tools)", checkboxWithTitle: "Automatically upgrade formulae (command-line tools)",
target: self, target: self,
@ -99,18 +103,9 @@ class SettingsWindowController: NSWindowController {
action: #selector(toggleAutoUpgradeCasks(_:)) action: #selector(toggleAutoUpgradeCasks(_:))
) )
let caskWarning = NSTextField( let caskWarningRow = noteRow(
wrappingLabelWithString: "⚠️ Upgrading a cask can close and replace the app while it is running (e.g. your browser), without warning." "⚠️ Upgrading a cask can close and replace the app while it is running (e.g. your browser), without warning."
) )
caskWarning.font = .systemFont(ofSize: NSFont.smallSystemFontSize)
caskWarning.textColor = .secondaryLabelColor
caskWarning.preferredMaxLayoutWidth = 320
// indent the note so it reads as belonging to the checkbox above
let spacer = NSView()
spacer.widthAnchor.constraint(equalToConstant: 18).isActive = true
let caskWarningRow = NSStackView(views: [spacer, caskWarning])
caskWarningRow.orientation = .horizontal
notifyCheckbox = NSButton( notifyCheckbox = NSButton(
checkboxWithTitle: "Notify when new updates are found", checkboxWithTitle: "Notify when new updates are found",
@ -134,6 +129,7 @@ class SettingsWindowController: NSWindowController {
frequencyRow, frequencyRow,
customRow, customRow,
greedyCheckbox, greedyCheckbox,
greedyNote,
separator(), separator(),
autoUpgradeFormulaeCheckbox, autoUpgradeFormulaeCheckbox,
autoUpgradeCasksCheckbox, autoUpgradeCasksCheckbox,
@ -191,6 +187,22 @@ class SettingsWindowController: NSWindowController {
return box return box
} }
/// Small gray explanatory text, indented to read as belonging to the
/// checkbox above it.
func noteRow(_ text: String) -> NSStackView {
let label = NSTextField(wrappingLabelWithString: text)
label.font = .systemFont(ofSize: NSFont.smallSystemFontSize)
label.textColor = .secondaryLabelColor
label.preferredMaxLayoutWidth = 320
let spacer = NSView()
spacer.widthAnchor.constraint(equalToConstant: 18).isActive = true
let row = NSStackView(views: [spacer, label])
row.orientation = .horizontal
return row
}
// MARK: - Actions // MARK: - Actions
@objc func presetPicked(_ sender: NSPopUpButton) { @objc func presetPicked(_ sender: NSPopUpButton) {