ui: restore visible caption Off and compact settings controls

This commit is contained in:
2026-10-12 23:40:37 +02:00
parent 2398370c23
commit e66f45d9ef
4 changed files with 60 additions and 13 deletions
+22
View File
@@ -90,6 +90,14 @@ private enum CLIInstanceCheck {
}
}
static func captionSelector(in view: NSView) -> NSPopUpButton? {
if let selector = view as? NSPopUpButton, selector.toolTip == "Subtitles" { return selector }
for child in view.subviews {
if let selector = captionSelector(in: child) { return selector }
}
return nil
}
static func run(_ configuration: URL) {
let settings = try! JSONSerialization.jsonObject(with: Data(contentsOf: configuration)) as! [String: String]
let directory = URL(fileURLWithPath: settings["directory"]!, isDirectory: true)
@@ -139,6 +147,20 @@ private enum CLIInstanceCheck {
switch action {
case "youtube":
model.openYouTube(command["url"] as! String)
case "caption":
guard let view = window.contentView, let selector = captionSelector(in: view),
let cell = selector.cell as? NSPopUpButtonCell, let menu = selector.menu else {
fatalError("Native captions selector is missing")
}
cell.attachPopUp(withFrame: selector.bounds, in: selector)
menu.update()
let label = command["label"] as! String
guard let item = menu.items.first(where: { $0.title == label }) else {
fatalError("Requested native subtitle selection is missing")
}
precondition(!item.isHidden && item.isEnabled, "Subtitle selection must be visible and enabled")
cell.dismissPopUp()
precondition(selectMenuItem(label, in: menu), "Native subtitle selection must be actionable")
case "seek":
let position = command["position"] as! Double
precondition(model.seekRelative(position - model.state.position), "Native seek must be accepted")