rvlib-shipkit 2.22.1 → 2.24.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.
- package/CHANGELOG.md +44 -0
- package/package.json +1 -1
- package/src/agent-time/render.ts +28 -14
- package/src/agent-time/report.ts +46 -25
- package/src/agent-time/store.ts +30 -10
- package/src/agent-time/timeline.ts +43 -15
- package/src/annex/annex.ts +3 -0
- package/src/annex/born.ts +464 -0
- package/src/annex/flush.ts +46 -0
- package/src/annex/offload.ts +171 -38
- package/src/annex/snapshots.ts +53 -0
- package/src/annex/tidy.ts +368 -0
- package/src/asks/asks-queue.ts +32 -11
- package/src/checks/SK041-annex-links.check.ts +4 -2
- package/src/checks/SK043-scratch-on-the-mac.check.ts +45 -0
- package/src/checks/SK044-behind-upstream.check.ts +38 -0
- package/src/cli/cmd_Annex.ts +60 -9
- package/src/cli/cmd_Asks.ts +2 -0
- package/src/cli/cmd_Backup.ts +7 -5
- package/src/cli/cmd_Bump.ts +1 -0
- package/src/cli/cmd_Capacity.ts +26 -0
- package/src/cli/cmd_Check.ts +1 -0
- package/src/cli/cmd_Checks.ts +1 -0
- package/src/cli/cmd_Ci.ts +1 -0
- package/src/cli/cmd_Commands.ts +50 -14
- package/src/cli/cmd_Home.ts +0 -1
- package/src/cli/cmd_Hooks.ts +1 -0
- package/src/cli/cmd_Mv.ts +1 -0
- package/src/cli/cmd_Rec.ts +17 -7
- package/src/cli/cmd_Reflect.ts +1 -0
- package/src/cli/cmd_Releases.ts +1 -0
- package/src/cli/cmd_Review.ts +124 -17
- package/src/cli/cmd_Secret.ts +41 -2
- package/src/cli/cmd_Shot.ts +1 -0
- package/src/cli/cmd_Status.ts +1 -0
- package/src/cli/cmd_Time.ts +3 -1
- package/src/cli/cmd_Tmp.ts +82 -0
- package/src/cli/cmd_Wiki.ts +1 -0
- package/src/cli/registry.ts +13 -1
- package/src/collections/pings.ts +1 -1
- package/src/core/capacity.ts +71 -0
- package/src/core/check-runner.ts +86 -15
- package/src/core/machine-db.ts +8 -0
- package/src/core/motherhome.ts +67 -9
- package/src/core/slots.ts +49 -12
- package/src/core/trace-audit.ts +4 -1
- package/src/drill/run.ts +5 -2
- package/src/home/daemon-jobs.ts +10 -3
- package/src/home/global-units.ts +3 -0
- package/src/home/gui-app/ShipkitGui.swift +1 -0
- package/src/home/home-launchd.ts +11 -3
- package/src/home/home-routes.ts +11 -4
- package/src/home/machine-host.ts +65 -0
- package/src/home/machine-stores.ts +30 -4
- package/src/home/machine-temp.ts +493 -0
- package/src/home/other-macs.ts +74 -0
- package/src/home/pm.ts +4 -1
- package/src/home/run-daemon.ts +10 -2
- package/src/home/run-pm.ts +1 -0
- package/src/home/serve-web.ts +2 -2
- package/src/home/via-hub.ts +6 -1
- package/src/identities/identities.ts +92 -24
- package/src/init-repo.ts +7 -3
- package/src/ledger/ledger.ts +6 -0
- package/src/ledger/store.ts +6 -0
- package/src/media-store/backup/keys.ts +21 -6
- package/src/media-store/backup/manifest.ts +52 -11
- package/src/media-store/backup/restore.ts +17 -10
- package/src/media-store/backup/run.ts +5 -2
- package/src/media-store/backup/sources.ts +2 -1
- package/src/media-store/daemon.ts +2 -2
- package/src/media-store/purge.ts +4 -0
- package/src/mv/mv-md.ts +121 -42
- package/src/recordings/load.ts +3 -3
- package/src/recordings/model.ts +7 -0
- package/src/recordings/open.ts +12 -0
- package/src/recordings/presets.ts +12 -5
- package/src/recordings/recorder-app/Capture.swift +34 -5
- package/src/recordings/recorder-app/Clip.swift +126 -17
- package/src/recordings/recorder-app/Editor.swift +177 -7
- package/src/recordings/recorder-app/Hud.swift +189 -0
- package/src/recordings/recorder-app/Tray.swift +179 -36
- package/src/recordings/recorder-app/icon.svg +16 -0
- package/src/recordings/recorder-app/main.swift +349 -18
- package/src/recordings/recorder-app.ts +8 -4
- package/src/recordings/recorder.shipkit.ts +2 -1
- package/src/recordings/routes.ts +52 -6
- package/src/recordings/run-recorder.ts +2 -1
- package/src/recordings/share.ts +27 -0
- package/src/recordings/take.ts +36 -4
- package/src/recordings/view.ts +11 -0
- package/src/reflect/transcript.ts +56 -11
- package/src/releases/from-card.ts +45 -3
- package/src/releases/model.ts +6 -0
- package/src/releases/store.ts +8 -1
- package/src/repo-config.ts +14 -4
- package/src/review/cells.ts +24 -3
- package/src/review/format.ts +33 -9
- package/src/review/media-kind.ts +14 -11
- package/src/review/media-read.ts +6 -5
- package/src/review/model.ts +104 -7
- package/src/review/paste.ts +2 -1
- package/src/review/previews.ts +123 -36
- package/src/review/routes.ts +29 -18
- package/src/review/store.ts +74 -12
- package/src/review/threads.ts +7 -5
- package/src/secrets/copy.ts +110 -0
- package/src/secrets/list.ts +17 -7
- package/src/serve/hub-app/home-strip.css +5 -0
- package/src/serve/hub-app/home-strip.tsx +18 -0
- package/src/serve/hub-app/hub-app.tsx +2 -1
- package/src/serve/hub-app/hub.css +18 -0
- package/src/serve/hub-app/inbox.css +1 -0
- package/src/serve/hub-app/pull-refresh.tsx +88 -0
- package/src/serve/hub-app/recordings-st.ts +135 -24
- package/src/serve/hub-app/recordings-view.tsx +293 -54
- package/src/serve/hub-app/recordings.css +77 -24
- package/src/serve/hub-app/review/review-cells.tsx +52 -13
- package/src/serve/hub-app/review/review-list.tsx +6 -1
- package/src/serve/hub-app/review/review-st.ts +6 -5
- package/src/serve/hub-app/review/review-thread.tsx +3 -1
- package/src/serve/hub-app/review/review-views.tsx +18 -11
- package/src/serve/hub-app/review/thread-st.ts +82 -14
- package/src/serve/hub-app/review.css +15 -2
- package/src/serve/hub-runtime.ts +2 -1
- package/src/serve/run-serve.ts +4 -2
- package/src/serve/serve-hub.ts +9 -2
- package/src/shipkit-files.ts +5 -0
- package/src/social/drafts.ts +4 -3
- package/src/social/load.ts +7 -2
- package/src/social/publish/discord.ts +10 -3
- package/src/suite/child-tools.ts +45 -0
- package/src/suite/judge-suites.ts +10 -22
- package/src/suite/select.ts +83 -8
- package/src/suite/suite-cli.ts +38 -14
- package/src/suite/suite-cores.ts +68 -0
- package/src/suite/suite-reads-preload.ts +8 -6
- package/src/ts/config.ts +44 -0
- package/src/ts/rename.ts +11 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// the recent captures
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// the recent captures (wiki tools/shipkit/recordings.md, The recorder): an easy place, always on after a capture, to
|
|
2
|
+
// see and reach the recent ones: the newest captures as thumbs, a click opens one in the editor, a right click copies
|
|
3
|
+
// the file or a link or shows it in the Finder. One window at a time holds them: while the editor window is open they
|
|
4
|
+
// sit under it, else they are a small floating panel of their own, on every Space, draggable (it remembers where).
|
|
5
|
+
// They show after each capture and stay until switched off; the menu and the tray's hotkey switch them
|
|
5
6
|
import AppKit
|
|
6
7
|
|
|
7
8
|
struct RecentItem: Decodable {
|
|
@@ -11,11 +12,23 @@ struct RecentItem: Decodable {
|
|
|
11
12
|
var still: Bool
|
|
12
13
|
var seconds: Double
|
|
13
14
|
var dir: String
|
|
15
|
+
/** where the WebP a copy makes of what plays is kept */
|
|
16
|
+
var webp: String?
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** the copy modes' colours, the editor page's own (hub.css, --recfile, --recwebp, --reclink): dark enough for the
|
|
20
|
+
* white text and pictures on them */
|
|
21
|
+
enum Tint {
|
|
22
|
+
static let file = NSColor(srgbRed: 0x0b / 255, green: 0x63 / 255, blue: 0xce / 255, alpha: 1)
|
|
23
|
+
static let webp = NSColor(srgbRed: 0x1a / 255, green: 0x7f / 255, blue: 0x43 / 255, alpha: 1)
|
|
24
|
+
static let link = NSColor(srgbRed: 0x8a / 255, green: 0x3f / 255, blue: 0xc4 / 255, alpha: 1)
|
|
25
|
+
static let plain = NSColor(white: 0.36, alpha: 1)
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
@MainActor
|
|
17
29
|
final class RecentTray: NSObject {
|
|
18
30
|
static let SHOWN = "recentTrayShown"
|
|
31
|
+
static let DOCK_OFF = "recentUnderEditorOff"
|
|
19
32
|
static let MAX = 5
|
|
20
33
|
/** a cell's width: its poster, its name and its button bar */
|
|
21
34
|
static let W: CGFloat = 140
|
|
@@ -28,28 +41,67 @@ final class RecentTray: NSObject {
|
|
|
28
41
|
var pending = Set<String>()
|
|
29
42
|
/** a capture opened in the recorder's editor window */
|
|
30
43
|
var onEdit: ((String, String) -> Void)?
|
|
44
|
+
/** every capture as a grid, in the recorder's window */
|
|
45
|
+
var onGallery: (() -> Void)?
|
|
46
|
+
/** the × clicked once: red, a second click within ARM_SECONDS deletes for good */
|
|
47
|
+
private weak var armed: NSButton?
|
|
48
|
+
static let ARM_SECONDS = 3.0
|
|
31
49
|
|
|
32
|
-
|
|
50
|
+
/** the owner's switch of where the recent captures are now: their panel (off until a capture or the owner turns
|
|
51
|
+
* it on), or the band under the editor (on until the owner turns it off) */
|
|
52
|
+
var on: Bool {
|
|
53
|
+
get { host != nil ? !UserDefaults.standard.bool(forKey: RecentTray.DOCK_OFF) : UserDefaults.standard.bool(forKey: RecentTray.SHOWN) }
|
|
54
|
+
set { if host != nil { UserDefaults.standard.set(!newValue, forKey: RecentTray.DOCK_OFF) } else { UserDefaults.standard.set(newValue, forKey: RecentTray.SHOWN) } }
|
|
55
|
+
}
|
|
56
|
+
/** set while the editor window is open: the strip goes to it (nil takes it away) and the panel stays hidden, so
|
|
57
|
+
* the captures and the editor are one window */
|
|
58
|
+
var host: ((NSView?) -> Void)? { didSet { render() } }
|
|
59
|
+
/** the capture the editor shows, `<repo>/<id>`: its thumb is ringed under the editor */
|
|
60
|
+
var current: String? { didSet { if host != nil, current != oldValue { render() } } }
|
|
61
|
+
/** the strip drawn last: what a proof's hover reaches */
|
|
62
|
+
private var row: NSStackView?
|
|
33
63
|
|
|
34
|
-
/** the newest captures read again;
|
|
64
|
+
/** the newest captures read again; switched on when `show`, else left as the owner has them */
|
|
35
65
|
func refresh(show: Bool) async {
|
|
36
66
|
guard let sk else { return }
|
|
37
67
|
let r = await sk(["rec", "--json"])
|
|
38
68
|
items = r.out.split(separator: "\n").prefix(RecentTray.MAX).compactMap { try? JSONDecoder().decode(RecentItem.self, from: Data($0.utf8)) }
|
|
39
|
-
if show
|
|
69
|
+
if show { on = true }
|
|
70
|
+
render()
|
|
40
71
|
}
|
|
41
72
|
|
|
42
73
|
func open() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
74
|
+
on = true
|
|
75
|
+
render()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** the strip drawn where it belongs now: under the editor while it is open, else in its own panel; nowhere when
|
|
79
|
+
* switched off */
|
|
80
|
+
func render() {
|
|
81
|
+
if let host {
|
|
82
|
+
panel?.orderOut(nil)
|
|
83
|
+
host(on ? content() : nil)
|
|
84
|
+
} else if on {
|
|
85
|
+
let p = panel ?? makePanel()
|
|
86
|
+
panel = p
|
|
87
|
+
p.contentView = content()
|
|
88
|
+
p.setContentSize(p.contentView!.fittingSize)
|
|
89
|
+
if !p.isVisible && p.frameAutosaveName.isEmpty == false && !p.setFrameUsingName(p.frameAutosaveName) { place(p) }
|
|
90
|
+
p.orderFrontRegardless()
|
|
91
|
+
} else {
|
|
92
|
+
panel?.orderOut(nil)
|
|
93
|
+
}
|
|
50
94
|
onChange?()
|
|
51
95
|
}
|
|
52
96
|
|
|
97
|
+
/** a proof's hover: cell `i` shows its ×, armed when `armed`, as the pointer and a first click would leave it */
|
|
98
|
+
func hover(_ i: Int, armed: Bool) {
|
|
99
|
+
guard let cells = row?.arrangedSubviews, cells.indices.contains(i),
|
|
100
|
+
let poster = (cells[i] as? NSStackView)?.arrangedSubviews.first as? HoverThumb else { return }
|
|
101
|
+
poster.close.isHidden = false
|
|
102
|
+
if armed { deleteClicked(poster.close) }
|
|
103
|
+
}
|
|
104
|
+
|
|
53
105
|
/** the open tray drawn to a png, title bar included, on its dark ground: a layout's proof, no screen grant needed */
|
|
54
106
|
func snapshot(to: URL) throws {
|
|
55
107
|
guard let p = panel, p.isVisible, let v = p.contentView?.superview ?? p.contentView else { throw Err("the tray is not open") }
|
|
@@ -66,9 +118,8 @@ final class RecentTray: NSObject {
|
|
|
66
118
|
}
|
|
67
119
|
|
|
68
120
|
func close() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
onChange?()
|
|
121
|
+
on = false
|
|
122
|
+
render()
|
|
72
123
|
}
|
|
73
124
|
|
|
74
125
|
private func place(_ p: NSPanel) {
|
|
@@ -93,6 +144,7 @@ final class RecentTray: NSObject {
|
|
|
93
144
|
|
|
94
145
|
private func content() -> NSView {
|
|
95
146
|
let row = NSStackView()
|
|
147
|
+
self.row = row
|
|
96
148
|
row.orientation = .horizontal
|
|
97
149
|
row.spacing = 8
|
|
98
150
|
row.edgeInsets = NSEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
|
|
@@ -100,7 +152,10 @@ final class RecentTray: NSObject {
|
|
|
100
152
|
row.addArrangedSubview(NSTextField(labelWithString: "no capture yet: a hotkey of the menu takes one"))
|
|
101
153
|
}
|
|
102
154
|
for (i, it) in items.enumerated() { row.addArrangedSubview(cell(it, i)) }
|
|
103
|
-
let all = NSButton(title: "All
|
|
155
|
+
let all = NSButton(title: "All captures", target: self, action: #selector(RecentTray.openAll))
|
|
156
|
+
all.image = NSImage(systemSymbolName: "square.grid.2x2", accessibilityDescription: "all captures")
|
|
157
|
+
all.imagePosition = .imageLeading
|
|
158
|
+
all.toolTip = "Every capture as a grid of thumbnails, in the Capture window"
|
|
104
159
|
all.bezelStyle = .rounded
|
|
105
160
|
all.controlSize = .small
|
|
106
161
|
// what a new capture puts on the clipboard, changed here as in the menu
|
|
@@ -148,6 +203,17 @@ final class RecentTray: NSObject {
|
|
|
148
203
|
menu.addItem(mi)
|
|
149
204
|
}
|
|
150
205
|
thumb.menu = menu
|
|
206
|
+
let del = NSButton(image: NSImage(systemSymbolName: "xmark", accessibilityDescription: "delete")!.withSymbolConfiguration(.init(pointSize: 8, weight: .bold))!, target: self, action: #selector(RecentTray.deleteClicked(_:)))
|
|
207
|
+
del.tag = i
|
|
208
|
+
disarm(del)
|
|
209
|
+
let poster = HoverThumb(thumb: thumb, close: del)
|
|
210
|
+
if host != nil, ref(it) == current {
|
|
211
|
+
poster.wantsLayer = true
|
|
212
|
+
poster.layer?.borderWidth = 2
|
|
213
|
+
poster.layer?.borderColor = NSColor.controlAccentColor.cgColor
|
|
214
|
+
poster.layer?.cornerRadius = 3
|
|
215
|
+
}
|
|
216
|
+
poster.onExit = { [weak self, weak del] in if let del, self?.armed === del { self?.disarm(del) } }
|
|
151
217
|
let len = it.still ? "still" : String(format: "%d:%02d", Int(it.seconds) / 60, Int(it.seconds) % 60)
|
|
152
218
|
let name = NSTextField(labelWithString: "\(it.name) · \(len)")
|
|
153
219
|
name.font = NSFont.systemFont(ofSize: 10)
|
|
@@ -157,13 +223,13 @@ final class RecentTray: NSObject {
|
|
|
157
223
|
name.widthAnchor.constraint(equalToConstant: RecentTray.W).isActive = true
|
|
158
224
|
// a still copies as either format, whatever the menu's choice for a new capture; a video copies its file
|
|
159
225
|
let copy: [NSButton] = it.still
|
|
160
|
-
? [labeled("PNG", "Copy as PNG: a paste attaches the file, or pastes the image", #selector(RecentTray.copyPng(_:)), i, .
|
|
161
|
-
labeled("WebP", "Copy as WebP HQ (high quality): about a tenth of the PNG", #selector(RecentTray.copyWebp(_:)), i, .
|
|
162
|
-
: [action("doc.on.doc", "Copy the file: a paste attaches it", #selector(RecentTray.copyFile(_:)), i, .
|
|
163
|
-
let acts = NSStackView(views: [action("folder", "Show in Finder", #selector(RecentTray.reveal(_:)), i, .
|
|
164
|
-
acts.spacing =
|
|
226
|
+
? [labeled("PNG", "Copy as PNG: a paste attaches the file, or pastes the image", #selector(RecentTray.copyPng(_:)), i, Tint.file),
|
|
227
|
+
labeled("WebP", "Copy as WebP HQ (high quality): about a tenth of the PNG, made on its first copy and kept", #selector(RecentTray.copyWebp(_:)), i, Tint.webp)]
|
|
228
|
+
: [action("doc.on.doc", "Copy the file: a paste attaches it", #selector(RecentTray.copyFile(_:)), i, Tint.file)]
|
|
229
|
+
let acts = NSStackView(views: [action("folder", "Show in Finder", #selector(RecentTray.reveal(_:)), i, Tint.plain)] + copy + [action("link", "Copy a link: it plays in a browser for 7 days", #selector(RecentTray.copyLink(_:)), i, Tint.link)])
|
|
230
|
+
acts.spacing = 2
|
|
165
231
|
acts.distribution = .fill
|
|
166
|
-
var rows: [NSView] = [
|
|
232
|
+
var rows: [NSView] = [poster, name, acts]
|
|
167
233
|
if pending.contains(it.id) {
|
|
168
234
|
let spin = NSProgressIndicator()
|
|
169
235
|
spin.style = .spinning
|
|
@@ -187,10 +253,10 @@ final class RecentTray: NSObject {
|
|
|
187
253
|
// drawn by its own layer: the panel never takes focus, and a bezel colour shows only in a focused window
|
|
188
254
|
b.isBordered = false
|
|
189
255
|
b.wantsLayer = true
|
|
190
|
-
b.layer?.backgroundColor = color.
|
|
256
|
+
b.layer?.backgroundColor = color.cgColor
|
|
191
257
|
b.layer?.cornerRadius = 4
|
|
192
258
|
b.contentTintColor = .white
|
|
193
|
-
b.heightAnchor.constraint(equalToConstant:
|
|
259
|
+
b.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
|
194
260
|
b.tag = i
|
|
195
261
|
b.toolTip = tip
|
|
196
262
|
b.widthAnchor.constraint(equalToConstant: width).isActive = true
|
|
@@ -198,15 +264,15 @@ final class RecentTray: NSObject {
|
|
|
198
264
|
}
|
|
199
265
|
|
|
200
266
|
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:
|
|
202
|
-
return tinted(NSButton(image: img, target: self, action: sel), color,
|
|
267
|
+
let img = NSImage(systemSymbolName: symbol, accessibilityDescription: tip)!.withSymbolConfiguration(.init(pointSize: 10, weight: .semibold))!
|
|
268
|
+
return tinted(NSButton(image: img, target: self, action: sel), color, 28, tip, i)
|
|
203
269
|
}
|
|
204
270
|
|
|
205
271
|
private func labeled(_ title: String, _ tip: String, _ sel: Selector, _ i: Int, _ color: NSColor) -> NSButton {
|
|
206
272
|
let b = NSButton(title: title, target: self, action: sel)
|
|
207
|
-
b.font = NSFont.systemFont(ofSize:
|
|
273
|
+
b.font = NSFont.systemFont(ofSize: 10, weight: .semibold)
|
|
208
274
|
b.attributedTitle = NSAttributedString(string: title, attributes: [.foregroundColor: NSColor.white, .font: b.font!])
|
|
209
|
-
return tinted(b, color,
|
|
275
|
+
return tinted(b, color, 38, tip, i)
|
|
210
276
|
}
|
|
211
277
|
|
|
212
278
|
/** a button says it is done: a checkmark for a second, then its own picture again */
|
|
@@ -230,6 +296,48 @@ final class RecentTray: NSObject {
|
|
|
230
296
|
|
|
231
297
|
private func ref(_ it: RecentItem) -> String { "\(it.repo)/\(it.id)" }
|
|
232
298
|
|
|
299
|
+
/** the ×: a first click arms it (red, a bin), a second within ARM_SECONDS deletes the capture for good through
|
|
300
|
+
* `sk rec rm`, so a stray click never loses one */
|
|
301
|
+
@objc func deleteClicked(_ s: Any) {
|
|
302
|
+
guard let b = s as? NSButton, let it = item(s) else { return }
|
|
303
|
+
guard armed === b else {
|
|
304
|
+
if let was = armed { disarm(was) }
|
|
305
|
+
armed = b
|
|
306
|
+
b.image = NSImage(systemSymbolName: "trash.fill", accessibilityDescription: "delete for good")!.withSymbolConfiguration(.init(pointSize: 8, weight: .bold))!
|
|
307
|
+
b.layer?.backgroundColor = NSColor.systemRed.cgColor
|
|
308
|
+
b.toolTip = "Click again to delete it for good: off the Space, its folder to the Trash"
|
|
309
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + RecentTray.ARM_SECONDS) { [weak self, weak b] in
|
|
310
|
+
if let b, self?.armed === b { self?.disarm(b) }
|
|
311
|
+
}
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
armed = nil
|
|
315
|
+
b.isEnabled = false
|
|
316
|
+
Task {
|
|
317
|
+
let r = await sk?(["rec", "rm", ref(it), "--yes"])
|
|
318
|
+
if r?.code == 0 {
|
|
319
|
+
say("ok: deleted \(ref(it)) from the tray")
|
|
320
|
+
await refresh(show: false)
|
|
321
|
+
} else {
|
|
322
|
+
say("FAIL: sk rec rm \(ref(it)): \(r?.err.trimmingCharacters(in: .whitespacesAndNewlines) ?? "no sk")")
|
|
323
|
+
b.isEnabled = true
|
|
324
|
+
disarm(b)
|
|
325
|
+
done(b, ok: false)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
private func disarm(_ b: NSButton) {
|
|
331
|
+
if armed === b { armed = nil }
|
|
332
|
+
b.image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "delete")!.withSymbolConfiguration(.init(pointSize: 8, weight: .bold))!
|
|
333
|
+
b.isBordered = false
|
|
334
|
+
b.wantsLayer = true
|
|
335
|
+
b.layer?.backgroundColor = NSColor(white: 0, alpha: 0.65).cgColor
|
|
336
|
+
b.layer?.cornerRadius = 9
|
|
337
|
+
b.contentTintColor = .white
|
|
338
|
+
b.toolTip = "Delete this capture"
|
|
339
|
+
}
|
|
340
|
+
|
|
233
341
|
@objc func openItem(_ s: Any) {
|
|
234
342
|
guard let it = item(s) else { return }
|
|
235
343
|
onEdit?(it.repo, it.id)
|
|
@@ -240,10 +348,7 @@ final class RecentTray: NSObject {
|
|
|
240
348
|
onChange?()
|
|
241
349
|
}
|
|
242
350
|
|
|
243
|
-
@objc func openAll() {
|
|
244
|
-
guard let h = home, let u = URL(string: "\(h)/recordings") else { return }
|
|
245
|
-
NSWorkspace.shared.open(u)
|
|
246
|
-
}
|
|
351
|
+
@objc func openAll() { onGallery?() }
|
|
247
352
|
|
|
248
353
|
@objc func copyPng(_ s: Any) { copyStill(s, .png) }
|
|
249
354
|
@objc func copyWebp(_ s: Any) { copyStill(s, .webpHigh) }
|
|
@@ -258,7 +363,7 @@ final class RecentTray: NSObject {
|
|
|
258
363
|
f = ["out.png", "raw.png"].map { "\(it.dir)/\($0)" }.first { FileManager.default.fileExists(atPath: $0) }
|
|
259
364
|
}
|
|
260
365
|
guard let f else { done(s, ok: false); return }
|
|
261
|
-
let ok =
|
|
366
|
+
let ok = Clip.copy(ClipJob(pngFile: URL(fileURLWithPath: f), format: format, keep: it.webp.map { URL(fileURLWithPath: $0) })) { say("FAIL: \($0)") }
|
|
262
367
|
done(s, ok: ok)
|
|
263
368
|
}
|
|
264
369
|
}
|
|
@@ -291,8 +396,46 @@ final class RecentTray: NSObject {
|
|
|
291
396
|
extension RecentTray: NSWindowDelegate {
|
|
292
397
|
nonisolated func windowWillClose(_ notification: Notification) {
|
|
293
398
|
MainActor.assumeIsolated {
|
|
294
|
-
|
|
399
|
+
on = false
|
|
295
400
|
onChange?()
|
|
296
401
|
}
|
|
297
402
|
}
|
|
298
403
|
}
|
|
404
|
+
|
|
405
|
+
/** a capture's poster with its × in the top right corner, shown while the pointer is over it. The panel never takes
|
|
406
|
+
* the focus, so the hover tracks whether it is key or not */
|
|
407
|
+
final class HoverThumb: NSView {
|
|
408
|
+
let close: NSButton
|
|
409
|
+
var onExit: (() -> Void)?
|
|
410
|
+
|
|
411
|
+
init(thumb: NSButton, close: NSButton) {
|
|
412
|
+
self.close = close
|
|
413
|
+
super.init(frame: thumb.frame)
|
|
414
|
+
for v in [thumb, close] {
|
|
415
|
+
v.translatesAutoresizingMaskIntoConstraints = false
|
|
416
|
+
addSubview(v)
|
|
417
|
+
}
|
|
418
|
+
close.isHidden = true
|
|
419
|
+
NSLayoutConstraint.activate([
|
|
420
|
+
thumb.leadingAnchor.constraint(equalTo: leadingAnchor), thumb.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
421
|
+
thumb.topAnchor.constraint(equalTo: topAnchor), thumb.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
422
|
+
close.topAnchor.constraint(equalTo: topAnchor, constant: 4), close.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -4),
|
|
423
|
+
close.widthAnchor.constraint(equalToConstant: 18), close.heightAnchor.constraint(equalToConstant: 18),
|
|
424
|
+
])
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
required init?(coder: NSCoder) { nil }
|
|
428
|
+
|
|
429
|
+
override func updateTrackingAreas() {
|
|
430
|
+
super.updateTrackingAreas()
|
|
431
|
+
for t in trackingAreas { removeTrackingArea(t) }
|
|
432
|
+
addTrackingArea(NSTrackingArea(rect: .zero, options: [.mouseEnteredAndExited, .activeAlways, .inVisibleRect], owner: self))
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
override func mouseEntered(with e: NSEvent) { close.isHidden = false }
|
|
436
|
+
|
|
437
|
+
override func mouseExited(with e: NSEvent) {
|
|
438
|
+
close.isHidden = true
|
|
439
|
+
onExit?()
|
|
440
|
+
}
|
|
441
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 512 512">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#ff6a5c"/>
|
|
5
|
+
<stop offset="1" stop-color="#d3202a"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="512" height="512" fill="url(#g)"/>
|
|
9
|
+
<g fill="none" stroke="#ffffff" stroke-width="34" stroke-linecap="round" stroke-linejoin="round">
|
|
10
|
+
<path d="M112 196v-56a28 28 0 0 1 28-28h56"/>
|
|
11
|
+
<path d="M316 112h56a28 28 0 0 1 28 28v56"/>
|
|
12
|
+
<path d="M400 316v56a28 28 0 0 1-28 28h-56"/>
|
|
13
|
+
<path d="M196 400h-56a28 28 0 0 1-28-28v-56"/>
|
|
14
|
+
</g>
|
|
15
|
+
<circle cx="256" cy="256" r="78" fill="#ffffff"/>
|
|
16
|
+
</svg>
|