Mediensteuerung hochkant, Symbole wieder sichtbar, „Auto" als Zustand
Die Mediensteuerung stand nebeneinander: Cover links, alles andere in den verbleibenden gut hundert Punkten. Daher „Bernhard H…" statt eines Titels. Jetzt übereinander, wie es zu einer hochkanten Kachel passt. Das Cover ragte zusätzlich über die Kachel hinaus, weil `clipShape` vor dem Rahmen stand — beschnitten wurde damit auf die Eigengröße des Bildes, und die ist bei einem Podcast-Cover ein Vielfaches. Erst Rahmen, dann beschneiden. Menüleistensymbole waren kaum zu sehen. `color.set()` vor `image.draw(in:)` färbt ein Template-Bild nicht: es wird schwarz gezeichnet, auf einer dunklen Menüleiste also unsichtbar. AppKit färbt Template-Bilder nur ein, wenn sie als `image` eines Buttons gesetzt sind — in einer selbst gezeichneten Ansicht muss die Farbe in die Symbolkonfiguration. Betraf alle fünf Zeichenstellen, nicht nur die Lüfter. „fans.auto" stand als roher Schlüssel da: Xcode hatte ihn extrahiert, gefüllt wurde er nie. Beim Nachsehen waren es 35 solche Einträge über alle Kataloge hinweg — die meisten reine Formatschlüssel, die als Durchreicher trotzdem einen Wert brauchen. Der Automatik-Knopf ist jetzt eine gefüllte Pille, wenn sie greift. Blauer Text sieht aus wie ein Link und nicht wie ein Zustand. Und ein Absturz, der noch niemandem passiert ist: meldet der Helfer für einen stehenden Lüfter keine Grenzen, hätte `Slider(in: 0...0)` die App beendet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,22 +98,46 @@ private struct FanRow: View {
|
||||
.foregroundStyle(Onyx.Color.textPrimary)
|
||||
}
|
||||
|
||||
HStack(spacing: 6) {
|
||||
HStack(spacing: 8) {
|
||||
// Automatik ist der Ruhezustand und bleibt einen Klick entfernt:
|
||||
// wer manuell geregelt hat, muss ohne Nachdenken zurückkönnen.
|
||||
// Als gefüllte Pille, wenn sie greift — ein blauer Text sieht
|
||||
// aus wie ein Link und nicht wie ein Zustand.
|
||||
Button { control.setAutomatic(index: index) } label: {
|
||||
Text("fans.auto")
|
||||
.font(Onyx.Font.caption)
|
||||
.font(Onyx.Font.metricSmall)
|
||||
.foregroundStyle(fan.isManual ? Onyx.Color.textTertiary
|
||||
: Onyx.Color.accent)
|
||||
: Onyx.Color.surface)
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 2)
|
||||
.background {
|
||||
Capsule()
|
||||
.fill(fan.isManual ? Color.clear : Onyx.Color.accent)
|
||||
.overlay {
|
||||
Capsule().strokeBorder(
|
||||
fan.isManual ? Onyx.Color.hairline : .clear,
|
||||
lineWidth: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.disabled(!fan.isManual)
|
||||
|
||||
Slider(value: Binding(
|
||||
get: { fan.targetRPM },
|
||||
set: { control.setTarget(index: index, rpm: $0) }),
|
||||
in: fan.limits.minimum...fan.limits.maximum)
|
||||
.controlSize(.mini)
|
||||
// Ein Regler über einen leeren Bereich stürzt ab. Meldet der
|
||||
// Helfer keine brauchbaren Grenzen — etwa weil der Lüfter steht
|
||||
// und der SMC nichts hergibt —, gibt es nichts zu ziehen.
|
||||
if fan.limits.maximum > fan.limits.minimum {
|
||||
Slider(value: Binding(
|
||||
get: { min(max(fan.targetRPM, fan.limits.minimum), fan.limits.maximum) },
|
||||
set: { control.setTarget(index: index, rpm: $0) }),
|
||||
in: fan.limits.minimum...fan.limits.maximum)
|
||||
.controlSize(.mini)
|
||||
} else {
|
||||
Text("fans.noRange")
|
||||
.font(Onyx.Font.metricSmall)
|
||||
.foregroundStyle(Onyx.Color.textTertiary)
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,19 +243,16 @@ private final class FanStatusView: NSView, WidthReporting {
|
||||
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
let color = NSColor.labelColor
|
||||
guard let image = NSImage(systemSymbolName: "fan", accessibilityDescription: nil)
|
||||
else { return }
|
||||
image.isTemplate = true
|
||||
|
||||
if presentation == .symbol {
|
||||
color.set()
|
||||
image.draw(in: NSRect(x: bounds.midX - 7.5, y: bounds.midY - 7.5,
|
||||
width: 15, height: 15))
|
||||
MenuBarText.drawSymbol("fan", color: color,
|
||||
in: NSRect(x: bounds.midX - 7.5, y: bounds.midY - 7.5,
|
||||
width: 15, height: 15))
|
||||
return
|
||||
}
|
||||
|
||||
color.set()
|
||||
image.draw(in: NSRect(x: 0, y: bounds.midY - 6.5, width: 13, height: 13))
|
||||
MenuBarText.drawSymbol("fan", color: color,
|
||||
in: NSRect(x: 0, y: bounds.midY - 6.5, width: 13, height: 13))
|
||||
MenuBarText.draw(rpm.map { String(Int($0.rounded())) } ?? "–",
|
||||
color: color,
|
||||
in: NSRect(x: 15, y: 0, width: bounds.width - 15, height: bounds.height))
|
||||
|
||||
Reference in New Issue
Block a user