Skip to content

Commit 692fac2

Browse files
committed
Correct stale comments and document non-obvious logic
1 parent e974fdb commit 692fac2

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

Sources/AdapterClient.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
// continuations so the consumer loops exit.
2323
//
2424
// `fetchNowPlayingOnce` at the bottom runs the adapter in one-shot
25-
// `get` mode for `status`.
25+
// `get` mode to prime the controller's first evaluation at startup
26+
// and on wake.
2627

2728
import Foundation
2829
import os
@@ -279,8 +280,9 @@ actor AdapterClient {
279280

280281
// MARK: - One-shot fetch (status command)
281282

282-
/// Synchronous one-shot `mediaremote-adapter.pl get` for the
283-
/// `status` subcommand. Blocks until the subprocess exits.
283+
/// Synchronous one-shot `mediaremote-adapter.pl get` used to prime
284+
/// Now Playing state at startup and on wake. Blocks until the
285+
/// subprocess exits.
284286
///
285287
/// `get` emits the raw payload dict (or JSON `null`), not the
286288
/// `{type, payload}` envelope that `stream` uses.

Sources/Commands.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Implementations of the CLI verbs: (default) foreground run,
2-
// `status`, `logs`, `version`, `help`. LaunchAgent lifecycle is
3-
// delegated to Homebrew (`brew services`).
2+
// `status`, `mode`, `deny`, `logs`, `version`, `help`. LaunchAgent
3+
// lifecycle is delegated to Homebrew (`brew services`).
44

55
import AppKit
66
import Foundation

Sources/FixedController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ final class FixedController {
2828

2929
private func toggle() {
3030
isHidden.toggle()
31+
// Fixed mode has no fullscreen signal; pass isFullScreen: true so
32+
// apply()'s FS guard always lets the write through.
3133
menuBar.apply(shouldHide: isHidden, isFullScreen: true)
3234
let verb = isHidden ? "hide" : "show"
3335
Log.controller.info("\(verb, privacy: .public) trig=hotkey mode=fixed")

Sources/HotkeyWatcher.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ final class HotkeyWatcher {
3636

3737
// MARK: Lifecycle
3838

39-
/// Returns false if the chord is already taken; non-fatal — the
39+
/// Returns false if registration fails — most often because the
40+
/// chord is already claimed by another app. Non-fatal: the
4041
/// daemon's automatic control still works without it.
4142
func start(chord: Chord = defaultChord) -> Bool {
4243
guard handlerRef == nil else { return true }

Sources/SmartController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ final class SmartController: NSObject {
107107
private var appOverrides: AppOverrides = .empty
108108

109109
/// Hotkey-driven override. Cleared only on Desktop arrival;
110-
/// survives front-app switches, FS↔FS hops, and play/pause.
110+
/// survives front-app switches, FS↔FS hops, play/pause, and
111+
/// sleep/wake.
111112
var overrule: Overrule = .auto
112113

113114
private var lastSnapshot: Snapshot?
@@ -279,7 +280,9 @@ final class SmartController: NSObject {
279280

280281
/// Single point of integration — every input channel funnels
281282
/// here. The `trigger` is preserved through to the log line so a
282-
/// surprising decision can be traced back to its input.
283+
/// surprising decision can be traced back to its input. `force`
284+
/// bypasses the snapshot dedup to re-assert the pref even when
285+
/// nothing changed (used on wake).
283286
private func evaluate(trigger: EvalTrigger, force: Bool = false) {
284287
let snap = takeSnapshot()
285288

0 commit comments

Comments
 (0)