rvlib-shipkit 2.20.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +1 -1
  3. package/src/asks/asks-queue.ts +8 -7
  4. package/src/assets/kits/identity-kit.ts +158 -2
  5. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  6. package/src/cli/cmd_Bump.ts +3 -3
  7. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  8. package/src/cli/cmd_Home.ts +1 -1
  9. package/src/cli/cmd_Overview.ts +2 -1
  10. package/src/cli/cmd_Rec.ts +349 -0
  11. package/src/cli/cmd_Releases.ts +42 -3
  12. package/src/cli/cmd_Review.ts +22 -13
  13. package/src/cli/cmd_Secret.ts +10 -3
  14. package/src/cli/cmd_Sign.ts +24 -0
  15. package/src/cli/cmd_Social.ts +57 -8
  16. package/src/cli/cmd_Sound.ts +17 -4
  17. package/src/cli/cmd_Trailer.ts +67 -1
  18. package/src/cli/family-pages.ts +1 -0
  19. package/src/cli/registry.ts +6 -1
  20. package/src/collections/collection-types.ts +1 -1
  21. package/src/collections/review.ts +23 -4
  22. package/src/core/agent-spawn.ts +4 -17
  23. package/src/core/code-lines.ts +49 -0
  24. package/src/core/discover-checks.ts +27 -3
  25. package/src/core/hard-reset.ts +34 -0
  26. package/src/core/layout.ts +6 -0
  27. package/src/core/raw-access.ts +3 -13
  28. package/src/core/throwaway-worktree.ts +72 -0
  29. package/src/home/app-sign.ts +98 -0
  30. package/src/home/gui-app/ShipkitGui.swift +35 -0
  31. package/src/home/gui-app.ts +31 -11
  32. package/src/home/home-routes.ts +6 -0
  33. package/src/home/pm-switch.ts +112 -0
  34. package/src/home/serve-web.ts +1 -1
  35. package/src/identities/identities.ts +17 -6
  36. package/src/media-kinds.ts +5 -3
  37. package/src/media-store/forget.ts +54 -0
  38. package/src/media-store/put.ts +4 -3
  39. package/src/media-store/space.ts +63 -24
  40. package/src/messages/brief.ts +3 -3
  41. package/src/messages/score.ts +2 -0
  42. package/src/recordings/delete.ts +19 -0
  43. package/src/recordings/edit.ts +231 -0
  44. package/src/recordings/load.ts +37 -0
  45. package/src/recordings/marks-draw.ts +111 -0
  46. package/src/recordings/marks-png.ts +25 -0
  47. package/src/recordings/marks.ts +138 -0
  48. package/src/recordings/media-kind.ts +67 -0
  49. package/src/recordings/model.ts +170 -0
  50. package/src/recordings/open.ts +33 -0
  51. package/src/recordings/place.ts +89 -0
  52. package/src/recordings/presets.ts +99 -0
  53. package/src/recordings/recorder-app/Capture.swift +510 -0
  54. package/src/recordings/recorder-app/Clip.swift +107 -0
  55. package/src/recordings/recorder-app/Editor.swift +39 -0
  56. package/src/recordings/recorder-app/Tray.swift +298 -0
  57. package/src/recordings/recorder-app/main.swift +859 -0
  58. package/src/recordings/recorder-app.ts +46 -0
  59. package/src/recordings/recorder.shipkit.ts +11 -0
  60. package/src/recordings/routes.ts +140 -0
  61. package/src/recordings/run-recorder.ts +40 -0
  62. package/src/recordings/share.ts +107 -0
  63. package/src/recordings/take.ts +146 -0
  64. package/src/recordings/view.ts +40 -0
  65. package/src/release/gate-checkout.ts +74 -0
  66. package/src/release/release-scope.ts +35 -26
  67. package/src/release/run-bump.ts +79 -37
  68. package/src/release/run-release.ts +67 -53
  69. package/src/releases/add.ts +38 -5
  70. package/src/releases/before.ts +31 -0
  71. package/src/releases/from-card.ts +105 -20
  72. package/src/releases/model.ts +100 -18
  73. package/src/releases/pictures.ts +29 -8
  74. package/src/repo-config.ts +7 -3
  75. package/src/review/http.ts +1 -1
  76. package/src/review/model.ts +12 -2
  77. package/src/review/stage-card.ts +1 -1
  78. package/src/review/store.ts +12 -2
  79. package/src/review/trailer-desk.ts +20 -0
  80. package/src/review/trailer-model.ts +67 -0
  81. package/src/review/trailer-routes.ts +98 -1
  82. package/src/review/trailer-voices.ts +144 -0
  83. package/src/review/watchers.ts +58 -1
  84. package/src/secrets/manager.ts +18 -1
  85. package/src/serve/hub-app/benign-errors.ts +22 -0
  86. package/src/serve/hub-app/hash-route.ts +27 -15
  87. package/src/serve/hub-app/home-st.ts +23 -5
  88. package/src/serve/hub-app/home.html +1 -0
  89. package/src/serve/hub-app/hub-app.tsx +8 -1
  90. package/src/serve/hub-app/icons.tsx +2 -0
  91. package/src/serve/hub-app/palette-st.ts +1 -0
  92. package/src/serve/hub-app/project-list.css +7 -2
  93. package/src/serve/hub-app/project-list.tsx +10 -0
  94. package/src/serve/hub-app/projects-svc.ts +17 -7
  95. package/src/serve/hub-app/recordings-st.ts +641 -0
  96. package/src/serve/hub-app/recordings-view.tsx +504 -0
  97. package/src/serve/hub-app/recordings.css +82 -0
  98. package/src/serve/hub-app/releases/releases-page.tsx +121 -28
  99. package/src/serve/hub-app/releases/releases-st.ts +46 -4
  100. package/src/serve/hub-app/releases.css +30 -3
  101. package/src/serve/hub-app/repo-sections.ts +1 -1
  102. package/src/serve/hub-app/repo-st.ts +16 -11
  103. package/src/serve/hub-app/review/clip-st.ts +3 -1
  104. package/src/serve/hub-app/review/kit.tsx +3 -3
  105. package/src/serve/hub-app/review/trailer-page.tsx +32 -6
  106. package/src/serve/hub-app/review/trailer-st.ts +184 -8
  107. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -4
  108. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  109. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  110. package/src/serve/hub-app/review.css +90 -0
  111. package/src/serve/hub-app/social/comms-page.tsx +10 -5
  112. package/src/serve/hub-app/social/next-release.tsx +118 -0
  113. package/src/serve/hub-app/social/post-card.tsx +31 -3
  114. package/src/serve/hub-app/social/social-model.ts +6 -0
  115. package/src/serve/hub-app/social/social-st.ts +50 -1
  116. package/src/serve/hub-app/social.css +12 -0
  117. package/src/serve/hub-app/tree-build.ts +2 -0
  118. package/src/serve/project-gutter-route.ts +8 -0
  119. package/src/serve/project-gutter.ts +4 -2
  120. package/src/shipkit.ts +2 -2
  121. package/src/shot/box.ts +49 -22
  122. package/src/shot/browser-slot.ts +13 -3
  123. package/src/shot/client.ts +1 -1
  124. package/src/shot/film-box.ts +193 -117
  125. package/src/shot/shooter.ts +20 -8
  126. package/src/smoke/run-smoke.ts +8 -6
  127. package/src/social/compose.ts +14 -0
  128. package/src/social/desk-index.ts +49 -8
  129. package/src/social/discord-layout.ts +6 -2
  130. package/src/social/drafts.ts +1 -1
  131. package/src/social/kinds.ts +3 -2
  132. package/src/social/load.ts +42 -9
  133. package/src/social/publish/index.ts +27 -10
  134. package/src/social/publish/secret.ts +12 -4
  135. package/src/social/release-card.ts +69 -0
  136. package/src/social/release-stage.ts +173 -30
  137. package/src/social/routes.ts +7 -1
  138. package/src/social/stage.ts +45 -22
  139. package/src/trailer/bed.ts +111 -0
  140. package/src/trailer/build.ts +81 -38
  141. package/src/trailer/ffmpeg.ts +14 -0
  142. package/src/trailer/grammar.ts +32 -4
  143. package/src/trailer/graph.ts +12 -1
  144. package/src/trailer/look.ts +7 -0
  145. package/src/trailer/shot-plan.ts +75 -0
  146. package/src/trailer/shot-state.ts +191 -0
  147. package/src/trailer/sound/audio.ts +28 -0
  148. package/src/trailer/sound/brand.ts +53 -3
  149. package/src/trailer/sound/gen.ts +61 -2
  150. package/src/trailer/sound/index.ts +25 -11
  151. package/src/trailer/sound/presets.ts +86 -5
  152. package/src/trailer/sound/run.ts +1 -1
  153. package/src/trailer/sound/takes.ts +94 -0
  154. package/src/trailer/titles.ts +36 -0
  155. package/src/trailer/url.ts +1 -1
  156. package/src/veille/chrome.ts +6 -3
@@ -0,0 +1,298 @@
1
+ // the recent captures tray (wiki tools/shipkit/recordings.md, The recorder): an easy place, always on after a capture,
2
+ // to see and reach the recent ones. A small floating panel, on every Space, draggable (it remembers where): the newest captures as thumbs, a click opens one in the
3
+ // hub's editor, a right click copies the file or a link or shows it in the Finder. It shows after each capture and
4
+ // stays until closed; the menu brings it back
5
+ import AppKit
6
+
7
+ struct RecentItem: Decodable {
8
+ var id: String
9
+ var name: String
10
+ var repo: String
11
+ var still: Bool
12
+ var seconds: Double
13
+ var dir: String
14
+ }
15
+
16
+ @MainActor
17
+ final class RecentTray: NSObject {
18
+ static let SHOWN = "recentTrayShown"
19
+ static let MAX = 5
20
+ /** a cell's width: its poster, its name and its button bar */
21
+ static let W: CGFloat = 140
22
+ var panel: NSPanel?
23
+ var items: [RecentItem] = []
24
+ var home: String?
25
+ var sk: (([String]) async -> (out: String, err: String, code: Int32))?
26
+ var onChange: (() -> Void)?
27
+ /** the captures whose upload and links still run: their cell spins */
28
+ var pending = Set<String>()
29
+ /** a capture opened in the recorder's editor window */
30
+ var onEdit: ((String, String) -> Void)?
31
+
32
+ var shown: Bool { panel?.isVisible == true }
33
+
34
+ /** the newest captures read again; the tray shown when `show`, or kept as it was */
35
+ func refresh(show: Bool) async {
36
+ guard let sk else { return }
37
+ let r = await sk(["rec", "--json"])
38
+ items = r.out.split(separator: "\n").prefix(RecentTray.MAX).compactMap { try? JSONDecoder().decode(RecentItem.self, from: Data($0.utf8)) }
39
+ if show || shown { open() }
40
+ }
41
+
42
+ func open() {
43
+ let p = panel ?? makePanel()
44
+ panel = p
45
+ p.contentView = content()
46
+ p.setContentSize(p.contentView!.fittingSize)
47
+ if !p.isVisible && p.frameAutosaveName.isEmpty == false && !p.setFrameUsingName(p.frameAutosaveName) { place(p) }
48
+ p.orderFrontRegardless()
49
+ UserDefaults.standard.set(true, forKey: RecentTray.SHOWN)
50
+ onChange?()
51
+ }
52
+
53
+ /** the open tray drawn to a png, title bar included, on its dark ground: a layout's proof, no screen grant needed */
54
+ func snapshot(to: URL) throws {
55
+ guard let p = panel, p.isVisible, let v = p.contentView?.superview ?? p.contentView else { throw Err("the tray is not open") }
56
+ guard let rep = v.bitmapImageRepForCachingDisplay(in: v.bounds) else { throw Err("the tray drew nothing") }
57
+ v.cacheDisplay(in: v.bounds, to: rep)
58
+ let img = NSImage(size: v.bounds.size)
59
+ img.lockFocus()
60
+ NSColor(white: 0.16, alpha: 1).setFill()
61
+ NSRect(origin: .zero, size: v.bounds.size).fill()
62
+ rep.draw(in: NSRect(origin: .zero, size: v.bounds.size))
63
+ img.unlockFocus()
64
+ guard let tiff = img.tiffRepresentation, let png = NSBitmapImageRep(data: tiff)?.representation(using: .png, properties: [:]) else { throw Err("the tray drew nothing") }
65
+ try png.write(to: to)
66
+ }
67
+
68
+ func close() {
69
+ panel?.orderOut(nil)
70
+ UserDefaults.standard.set(false, forKey: RecentTray.SHOWN)
71
+ onChange?()
72
+ }
73
+
74
+ private func place(_ p: NSPanel) {
75
+ let v = (NSScreen.main ?? NSScreen.screens[0]).visibleFrame
76
+ p.setFrameOrigin(NSPoint(x: v.maxX - p.frame.width - 16, y: v.minY + 16))
77
+ }
78
+
79
+ private func makePanel() -> NSPanel {
80
+ let p = NSPanel(contentRect: NSRect(x: 0, y: 0, width: 300, height: 120), styleMask: [.nonactivatingPanel, .titled, .closable, .utilityWindow, .hudWindow], backing: .buffered, defer: false)
81
+ p.title = "Recent captures"
82
+ p.level = .floating
83
+ p.isFloatingPanel = true
84
+ p.hidesOnDeactivate = false
85
+ p.isMovableByWindowBackground = true
86
+ p.isReleasedWhenClosed = false
87
+ p.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
88
+ p.setFrameAutosaveName("ShipkitRecentTray")
89
+ p.delegate = self
90
+ place(p)
91
+ return p
92
+ }
93
+
94
+ private func content() -> NSView {
95
+ let row = NSStackView()
96
+ row.orientation = .horizontal
97
+ row.spacing = 8
98
+ row.edgeInsets = NSEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
99
+ if items.isEmpty {
100
+ row.addArrangedSubview(NSTextField(labelWithString: "no capture yet: a hotkey of the menu takes one"))
101
+ }
102
+ for (i, it) in items.enumerated() { row.addArrangedSubview(cell(it, i)) }
103
+ let all = NSButton(title: "All…", target: self, action: #selector(RecentTray.openAll))
104
+ all.bezelStyle = .rounded
105
+ all.controlSize = .small
106
+ // what a new capture puts on the clipboard, changed here as in the menu
107
+ let pick = NSPopUpButton(frame: .zero, pullsDown: false)
108
+ pick.controlSize = .small
109
+ pick.font = NSFont.systemFont(ofSize: 11)
110
+ for f in ClipFormat.allCases {
111
+ pick.addItem(withTitle: f.label)
112
+ pick.lastItem?.representedObject = f.rawValue
113
+ }
114
+ pick.selectItem(at: ClipFormat.allCases.firstIndex(of: ClipFormat.current) ?? 0)
115
+ pick.target = self
116
+ pick.action = #selector(RecentTray.formatPicked(_:))
117
+ pick.toolTip = "A new screenshot goes on the clipboard as this"
118
+ let label = NSTextField(labelWithString: "New captures copy as")
119
+ label.font = NSFont.systemFont(ofSize: 10)
120
+ label.textColor = .secondaryLabelColor
121
+ let side = NSStackView(views: [label, pick, all])
122
+ side.orientation = .vertical
123
+ side.alignment = .centerX
124
+ side.spacing = 6
125
+ row.addArrangedSubview(side)
126
+ return row
127
+ }
128
+
129
+ /** one capture: its poster (a click opens it), its name on one line, and under it Finder, copy file, copy link */
130
+ private func cell(_ it: RecentItem, _ i: Int) -> NSView {
131
+ let thumb = NSButton(frame: NSRect(x: 0, y: 0, width: RecentTray.W, height: RecentTray.W * 9 / 16))
132
+ thumb.isBordered = false
133
+ thumb.imagePosition = .imageOnly
134
+ thumb.imageScaling = .scaleProportionallyUpOrDown
135
+ thumb.image = NSImage(contentsOfFile: "\(it.dir)/poster.webp")
136
+ thumb.tag = i
137
+ thumb.target = self
138
+ thumb.action = #selector(RecentTray.openItem(_:))
139
+ thumb.toolTip = "\(it.repo)/\(it.name): click to edit"
140
+ thumb.widthAnchor.constraint(equalToConstant: RecentTray.W).isActive = true
141
+ thumb.heightAnchor.constraint(equalToConstant: RecentTray.W * 9 / 16).isActive = true
142
+ let menu = NSMenu()
143
+ let copies: [(String, Selector)] = it.still ? [("Copy as PNG", #selector(RecentTray.copyPng(_:))), ("Copy as WebP HQ", #selector(RecentTray.copyWebp(_:)))] : [("Copy the file", #selector(RecentTray.copyFile(_:)))]
144
+ for (title, sel) in [("Open in the editor", #selector(RecentTray.openItem(_:)))] + copies + [("Copy a link", #selector(RecentTray.copyLink(_:))), ("Show in Finder", #selector(RecentTray.reveal(_:)))] {
145
+ let mi = NSMenuItem(title: title, action: sel, keyEquivalent: "")
146
+ mi.target = self
147
+ mi.tag = i
148
+ menu.addItem(mi)
149
+ }
150
+ thumb.menu = menu
151
+ let len = it.still ? "still" : String(format: "%d:%02d", Int(it.seconds) / 60, Int(it.seconds) % 60)
152
+ let name = NSTextField(labelWithString: "\(it.name) · \(len)")
153
+ name.font = NSFont.systemFont(ofSize: 10)
154
+ name.textColor = .secondaryLabelColor
155
+ name.lineBreakMode = .byTruncatingMiddle
156
+ name.alignment = .center
157
+ name.widthAnchor.constraint(equalToConstant: RecentTray.W).isActive = true
158
+ // a still copies as either format, whatever the menu's choice for a new capture; a video copies its file
159
+ let copy: [NSButton] = it.still
160
+ ? [labeled("PNG", "Copy as PNG: a paste attaches the file, or pastes the image", #selector(RecentTray.copyPng(_:)), i, .systemBlue),
161
+ labeled("WebP", "Copy as WebP HQ (high quality): about a tenth of the PNG", #selector(RecentTray.copyWebp(_:)), i, .systemGreen)]
162
+ : [action("doc.on.doc", "Copy the file: a paste attaches it", #selector(RecentTray.copyFile(_:)), i, .systemBlue)]
163
+ let acts = NSStackView(views: [action("folder", "Show in Finder", #selector(RecentTray.reveal(_:)), i, .systemGray)] + copy + [action("link", "Copy a link: it plays in a browser for 7 days", #selector(RecentTray.copyLink(_:)), i, .systemPurple)])
164
+ acts.spacing = 1
165
+ acts.distribution = .fill
166
+ var rows: [NSView] = [thumb, name, acts]
167
+ if pending.contains(it.id) {
168
+ let spin = NSProgressIndicator()
169
+ spin.style = .spinning
170
+ spin.controlSize = .small
171
+ spin.startAnimation(nil)
172
+ let up = NSTextField(labelWithString: "uploading…")
173
+ up.font = NSFont.systemFont(ofSize: 10)
174
+ up.textColor = .secondaryLabelColor
175
+ let row = NSStackView(views: [spin, up])
176
+ row.spacing = 4
177
+ rows.insert(row, at: 2)
178
+ }
179
+ let col = NSStackView(views: rows)
180
+ col.orientation = .vertical
181
+ col.spacing = 4
182
+ return col
183
+ }
184
+
185
+ /** one button of a cell's bar: small, its own colour, so the four read apart with no gap between them */
186
+ private func tinted(_ b: NSButton, _ color: NSColor, _ width: CGFloat, _ tip: String, _ i: Int) -> NSButton {
187
+ // drawn by its own layer: the panel never takes focus, and a bezel colour shows only in a focused window
188
+ b.isBordered = false
189
+ b.wantsLayer = true
190
+ b.layer?.backgroundColor = color.withAlphaComponent(0.85).cgColor
191
+ b.layer?.cornerRadius = 4
192
+ b.contentTintColor = .white
193
+ b.heightAnchor.constraint(equalToConstant: 18).isActive = true
194
+ b.tag = i
195
+ b.toolTip = tip
196
+ b.widthAnchor.constraint(equalToConstant: width).isActive = true
197
+ return b
198
+ }
199
+
200
+ private func action(_ symbol: String, _ tip: String, _ sel: Selector, _ i: Int, _ color: NSColor) -> NSButton {
201
+ let img = NSImage(systemSymbolName: symbol, accessibilityDescription: tip)!.withSymbolConfiguration(.init(pointSize: 9, weight: .semibold))!
202
+ return tinted(NSButton(image: img, target: self, action: sel), color, 26, tip, i)
203
+ }
204
+
205
+ private func labeled(_ title: String, _ tip: String, _ sel: Selector, _ i: Int, _ color: NSColor) -> NSButton {
206
+ let b = NSButton(title: title, target: self, action: sel)
207
+ b.font = NSFont.systemFont(ofSize: 9, weight: .semibold)
208
+ b.attributedTitle = NSAttributedString(string: title, attributes: [.foregroundColor: NSColor.white, .font: b.font!])
209
+ return tinted(b, color, 36, tip, i)
210
+ }
211
+
212
+ /** a button says it is done: a checkmark for a second, then its own picture again */
213
+ private func done(_ s: Any, ok: Bool) {
214
+ guard let b = s as? NSButton else { return }
215
+ let (was, title) = (b.image, b.attributedTitle)
216
+ if was == nil { b.title = "" }
217
+ b.image = NSImage(systemSymbolName: ok ? "checkmark" : "exclamationmark.triangle", accessibilityDescription: ok ? "done" : "failed")
218
+ b.contentTintColor = ok ? .white : .systemYellow
219
+ DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) {
220
+ b.image = was
221
+ b.attributedTitle = title
222
+ b.contentTintColor = .white
223
+ }
224
+ }
225
+
226
+ private func item(_ s: Any) -> RecentItem? {
227
+ let tag = (s as? NSButton)?.tag ?? (s as? NSMenuItem)?.tag ?? -1
228
+ return items.indices.contains(tag) ? items[tag] : nil
229
+ }
230
+
231
+ private func ref(_ it: RecentItem) -> String { "\(it.repo)/\(it.id)" }
232
+
233
+ @objc func openItem(_ s: Any) {
234
+ guard let it = item(s) else { return }
235
+ onEdit?(it.repo, it.id)
236
+ }
237
+
238
+ @objc func formatPicked(_ p: NSPopUpButton) {
239
+ if let r = p.selectedItem?.representedObject as? String, let f = ClipFormat(rawValue: r) { ClipFormat.current = f }
240
+ onChange?()
241
+ }
242
+
243
+ @objc func openAll() {
244
+ guard let h = home, let u = URL(string: "\(h)/recordings") else { return }
245
+ NSWorkspace.shared.open(u)
246
+ }
247
+
248
+ @objc func copyPng(_ s: Any) { copyStill(s, .png) }
249
+ @objc func copyWebp(_ s: Any) { copyStill(s, .webpHigh) }
250
+
251
+ /** a still on the clipboard in `format`, as a capture puts it; one the disk no longer holds comes back through sk first */
252
+ private func copyStill(_ s: Any, _ format: ClipFormat) {
253
+ guard let it = item(s) else { return }
254
+ Task {
255
+ var f = ["out.png", "raw.png"].map { "\(it.dir)/\($0)" }.first { FileManager.default.fileExists(atPath: $0) }
256
+ if f == nil {
257
+ _ = await sk?(["rec", "copy", ref(it)])
258
+ f = ["out.png", "raw.png"].map { "\(it.dir)/\($0)" }.first { FileManager.default.fileExists(atPath: $0) }
259
+ }
260
+ guard let f else { done(s, ok: false); return }
261
+ let ok = (try? await Clip.put(try Clip.stage(URL(fileURLWithPath: f)), format)) != nil
262
+ done(s, ok: ok)
263
+ }
264
+ }
265
+
266
+ @objc func copyFile(_ s: Any) {
267
+ guard let it = item(s) else { return }
268
+ Task {
269
+ let r = await sk?(["rec", "copy", ref(it)])
270
+ done(s, ok: r?.code == 0)
271
+ }
272
+ }
273
+
274
+ @objc func copyLink(_ s: Any) {
275
+ guard let it = item(s) else { return }
276
+ Task {
277
+ let r = await sk?(["rec", "link", ref(it), "--copy"])
278
+ done(s, ok: r?.code == 0)
279
+ }
280
+ }
281
+
282
+ @objc func reveal(_ s: Any) {
283
+ guard let it = item(s) else { return }
284
+ // the file that plays, picked in its folder
285
+ let file = ["out.mp4", "out.png", "raw.mp4", "raw.png"].map { "\(it.dir)/\($0)" }.first { FileManager.default.fileExists(atPath: $0) }
286
+ NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: file ?? it.dir)])
287
+ done(s, ok: true)
288
+ }
289
+ }
290
+
291
+ extension RecentTray: NSWindowDelegate {
292
+ nonisolated func windowWillClose(_ notification: Notification) {
293
+ MainActor.assumeIsolated {
294
+ UserDefaults.standard.set(false, forKey: RecentTray.SHOWN)
295
+ onChange?()
296
+ }
297
+ }
298
+ }