Screenshots, hung out to dry. A tiny native macOS app that hangs every screenshot on a line at the top of your screen.
Swift
Pinned photos, Hang on Tendedero and Hold (#81)
Anubhav-Rai54118b1a335c
diff --git a/README.md b/README.mdindex 6972081..3e124e2 100644--- a/README.md+++ b/README.md@@ -55,6 +55,9 @@ Rest the pointer in the middle of the menu bar and it glides down. Move away and| Drag into a folder | Keep it there. It leaves the line. || Drag to the Trash, or click the cross | Let it go. || <kbd>⌘</kbd> <kbd>Z</kbd> with the pointer on the line | Hang back what you just let go. |+| Right click, then Pin | Keep it: it hangs left of the knot on a space grey clip, and no new screenshot pushes it off. |+| Right click, then Hold | Take it off the line and keep it in front of you while you work. |+| In Finder, right click an image, then Hang on Tendedero | Hang any image on the line, pinned. || Rest the pointer in the middle of the menu bar | Bring the line down on that screen. || Click anything in the menu bar | Put it away. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | Show or hide the line. Change it under Shortcut in the menu bar. |diff --git a/Sources/Tendedero/AppDelegate.swift b/Sources/Tendedero/AppDelegate.swiftindex a9a4e01..005c0ef 100644--- a/Sources/Tendedero/AppDelegate.swift+++ b/Sources/Tendedero/AppDelegate.swift@@ -84,6 +84,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {setUpStatusItem()watchMenuBarClicks()+ // Hang on Tendedero, in the menu of images in Finder and other apps.+ NSApp.servicesProvider = self+ NSUpdateDynamicServices()+Markup.shared.onSaved = { [weak self] url in self?.line.reloadThumbnail(for: url) }Trim.shared.onSaved = { [weak self] url in self?.line.reloadThumbnail(for: url) }panel.onScroll = { [weak self] event in@@ -93,6 +97,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {self?.line.scroll(by: event.hasPreciseScrollingDeltas ? delta : delta * 12)}line.onFall = { [weak self] item in self?.fall(item) }+ line.onHold = { [weak self] id in self?.hold(id) }+ line.onHangBack = { id in Held.hangBack(id) }line.$items.receive(on: RunLoop.main)@@ -264,6 +270,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {/// An empty line goes away, unless it was opened on purpose.private func itemsChanged() {updateStatusIcon()+ Held.forget(except: Set(line.items.filter { !$0.falling && $0.held }.map(\.id)))guard line.liveCount == 0, !keepOpen else { return }DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { [weak self] inguard let self, self.line.liveCount == 0, !self.keepOpen else { return }@@ -340,7 +347,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {guard isPresent, isRevealed, !item.flying, !Self.reducesMotion, let screen = panel.screen,let card = cardFrame(for: item.id),let image = item.thumb.cgImage(forProposedRect: nil, context: nil, hints: nil) else { return }- CaptureFlight.fall(image: image, card: card, tilt: CGFloat(item.tilt), on: screen)+ CaptureFlight.fall(image: image, card: card, tilt: CGFloat(item.tilt), pinned: item.kept, on: screen)}/// Where a card will hang, in screen coordinates, using the same layout@@ -614,6 +621,40 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {}}+ // MARK: Holding++ /// Takes a photo off the line to hold in front of you. The line goes+ /// up, so it is out of the way of the photo you are looking at.+ private func hold(_ id: UUID) {+ guard let item = line.items.first(where: { $0.id == id && !$0.falling && !$0.held }) else { return }+ line.setHeld(id, true)+ Held.show(id, url: item.url, line: line) { [weak self] id, frame in self?.hangBack(id, from: frame) }+ }++ /// Back onto its clip: the line comes down and the photo flies home.+ private func hangBack(_ id: UUID, from frame: CGRect) {+ line.setHeld(id, false)+ comeDown(on: NSScreen.screens.first { $0.frame.intersects(frame) })+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.03) { [weak self] in+ self?.fly(id, from: frame)+ }+ }++ // MARK: Hang on Tendedero++ /// The service macOS lists for images in Finder and elsewhere. What+ /// you hang yourself is pinned, and the line comes down to show it.+ @objc func hangOnLine(_ pasteboard: NSPasteboard, userData: String?,+ error: AutoreleasingUnsafeMutablePointer<NSString?>) {+ let urls = pasteboard.readObjects(forClasses: [NSURL.self],+ options: [.urlReadingFileURLsOnly: true]) as? [URL] ?? []+ guard !urls.isEmpty else { return }+ comeDown(on: nil)+ var any = false+ for url in urls where line.hangKept(url) { any = true }+ if !any { NSSound.beep() }+ }+// MARK: Putting back/// ⌘Z while the pointer is on the line. The line never takes the@@ -753,6 +794,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {putBackItem.isEnabled = line.canPutBackmenu.addItem(putBackItem)+ if !Held.heldIDs.isEmpty {+ menu.addItem(ClosureMenuItem(L("Hang everything back")) { Held.hangEverythingBack() })+ }+let inbox = ClosureMenuItem(L("Handle screenshots")) { [weak self] inself?.setInbox(!Inbox.isEnabled)}diff --git a/Sources/Tendedero/CaptureFlight.swift b/Sources/Tendedero/CaptureFlight.swiftindex 227efa0..df964b0 100644--- a/Sources/Tendedero/CaptureFlight.swift+++ b/Sources/Tendedero/CaptureFlight.swift@@ -73,9 +73,15 @@ final class CaptureFlight {/// A discarded card falling off the line, drawn over the whole screen so/// it is never cut by the line's strip. Same motion as the app always had:/// 520 points down, tilting further, fading, 0.55 s ease in.- static func fall(image: CGImage, card: CGRect, tilt: CGFloat, on screen: NSScreen) {+ static func fall(image: CGImage, card: CGRect, tilt: CGFloat, pinned: Bool = false, on screen: NSScreen) {let flight = CaptureFlight(image: image, from: card, to: card, tilt: tilt, screen: screen)flight.falling = true+ // A pinned photo falls with its space grey clip, as it hung.+ if pinned {+ flight.clip.colors = [NSColor(white: 0.30, alpha: 1).cgColor, NSColor(white: 0.47, alpha: 1).cgColor,+ NSColor(white: 0.38, alpha: 1).cgColor, NSColor(white: 0.24, alpha: 1).cgColor]+ flight.clip.borderColor = NSColor(white: 1, alpha: 0.35).cgColor+ }flight.duration = 0.55current.append(flight)flight.completion = { [weak flight] in current.removeAll { $0 === flight } }diff --git a/Sources/Tendedero/GrabArea.swift b/Sources/Tendedero/GrabArea.swiftindex 7d17f74..6483b1b 100644--- a/Sources/Tendedero/GrabArea.swift+++ b/Sources/Tendedero/GrabArea.swift@@ -31,6 +31,8 @@ struct GrabArea: NSViewRepresentable {let isRecording = item.isRecordingview.url = item.urlview.dragImage = item.thumb+ view.isHeld = item.held+ view.onHangBack = { line.onHangBack?(id) }view.onClick = { line.copy(id) }view.onDoubleClick = { line.open(id) }view.onDragStart = { line.draggingID = id }@@ -40,7 +42,7 @@ struct GrabArea: NSViewRepresentable {line.prune()}view.onTrash = { line.trash(id) }- view.onDiscard = { line.discard(id) }+ view.onDiscard = { line.pressCorner(id) }view.onLongPress = { line.markup(id) }view.onForceClick = { line.quickLook(id) }view.onPressChange = { pressed in line.pressedID = pressed ? id : nil }@@ -51,16 +53,32 @@ struct GrabArea: NSViewRepresentable {menu.addItem(ClosureMenuItem(L("Copy")) { line.copy(id) })menu.addItem(ClosureMenuItem(L("Open")) { line.open(id) })menu.addItem(ClosureMenuItem(L("Quick Look")) { line.quickLook(id) })+ if !isRecording {+ menu.addItem(ClosureMenuItem(L("Hold")) { line.onHold?(id) })+ }if !isRecording {menu.addItem(ClosureMenuItem(L("Markup")) { line.markup(id) })}menu.addItem(ClosureMenuItem(L("Show in Finder")) { line.reveal(id) })+ let item = line.items.first(where: { $0.id == id })+ let kept = item?.kept == true+ if !kept {+ menu.addItem(ClosureMenuItem(L("Pin")) { line.pin(id) })+ } else if item?.byHand == false {+ menu.addItem(ClosureMenuItem(L("Unpin")) { line.unpin(id) })+ }let inInbox = line.isInInbox(id)if inInbox {menu.addItem(ClosureMenuItem(L("Save to Desktop")) { line.saveToDesktop(id) })}menu.addItem(.separator())- if inInbox {+ if kept {+ // A pinned photo never goes to the Trash from here. One hung+ // by hand comes down; one pinned from the line is unpinned above.+ if item?.byHand == true {+ menu.addItem(ClosureMenuItem(L("Take down")) { line.discard(id) })+ }+ } else if inInbox {menu.addItem(ClosureMenuItem(L("Discard")) { line.discard(id) })} else {menu.addItem(ClosureMenuItem(L("Take down")) { line.discard(id) })@@ -84,6 +102,10 @@ final class GrabView: NSView, NSDraggingSource {var url: URL?var dragImage: NSImage?+ /// Held in your hand: only its faded trace is on the line, and a click+ /// on it is all it answers, to bring the photo back.+ var isHeld = false+ var onHangBack: () -> Void = {}var onClick: () -> Void = {}var onDoubleClick: () -> Void = {}var onDragStart: () -> Void = {}@@ -121,6 +143,11 @@ final class GrabView: NSView, NSDraggingSource {}override func mouseDown(with event: NSEvent) {+ if isHeld {+ downPoint = nil+ onHangBack()+ return+ }if event.clickCount > 1 {clickTimer?.invalidate()clickTimer = nil@@ -203,6 +230,7 @@ final class GrabView: NSView, NSDraggingSource {}override func rightMouseDown(with event: NSEvent) {+ guard !isHeld else { return }// The menu runs until it closes, and the line stays down meanwhile.GrabView.isShowingMenu = trueNSMenu.popUpContextMenu(menuProvider(), with: event, for: self)diff --git a/Sources/Tendedero/Held.swift b/Sources/Tendedero/Held.swiftnew file mode 100644index 0000000..5d0684f--- /dev/null+++ b/Sources/Tendedero/Held.swift@@ -0,0 +1,285 @@+import AppKit++/// A photo taken off the line to keep in front of you while you work: a+/// design to copy, numbers to type in, steps to follow. It is the photo+/// itself, not a copy: its clip waits empty on the line, and Hang back, or+/// Escape, sends it home.+///+/// It opens in the middle of the screen you are on, framed like a card.+/// Drag it anywhere; stretch it from an edge or a corner, or pinch or scroll+/// over it to zoom. Several can be held at+/// once. It never takes the app you are working in out of the front.+@MainActor+final class Held: NSObject {+ private static var open: [UUID: Held] = [:]++ let id: UUID+ private let panel: HeldPanel+ private let view: HeldView+ /// Its size at 100%, in points.+ private let natural: NSSize+ /// Called with where it was on screen, to fly back to its clip from there.+ private let onHangBack: (UUID, CGRect) -> Void++ static var heldIDs: Set<UUID> { Set(open.keys) }++ static func show(_ id: UUID, url: URL, line: Line, onHangBack: @escaping (UUID, CGRect) -> Void) {+ guard open[id] == nil,+ let screen = LinePanel.screenUnderPointer() else { return }+ // No sharper than the screen can show, so a huge image stays light.+ let longest = max(screen.frame.width, screen.frame.height) * screen.backingScaleFactor+ guard let image = makeThumbnail(url, maxPixels: Int(longest)), image.size.width > 0 else { return }+ open[id] = Held(id: id, url: url, image: image, on: screen, line: line, onHangBack: onHangBack)+ }++ static func hangBack(_ id: UUID) { open[id]?.hangBack() }++ static func hangEverythingBack() {+ for held in open.values { held.hangBack() }+ }++ /// Its photo left the line some other way: the file moved, for example.+ static func forget(except live: Set<UUID>) {+ for (id, held) in open where !live.contains(id) {+ held.panel.close()+ open[id] = nil+ }+ }++ private init(id: UUID, url: URL, image: NSImage, on screen: NSScreen, line: Line,+ onHangBack: @escaping (UUID, CGRect) -> Void) {+ self.id = id+ self.onHangBack = onHangBack+ let scale = screen.backingScaleFactor+ natural = NSSize(width: image.size.width / scale + HeldView.border * 2,+ height: image.size.height / scale + HeldView.border * 2)+ view = HeldView(image: image)+ panel = HeldPanel(content: view)+ super.init()+ view.onHangBack = { [weak self] in self?.hangBack() }+ view.onZoom = { [weak self] factor, anchor in self?.zoom(by: factor, around: anchor) }+ view.onActualSize = { [weak self] in self?.actualSize() }+ view.onCopy = { line.copy(id) }+ view.onMarkup = { line.markup(id) }+ view.onQuickLook = { line.quickLook(id) }+ // Stretched from an edge or a corner, it keeps the photo's shape.+ panel.contentAspectRatio = natural+ panel.minSize = NSSize(width: 80, height: 80)+ panel.setFrame(startFrame(on: screen), display: false)+ panel.orderFrontRegardless()+ }++ /// In the middle of the screen, each new one a little lower and to the+ /// right so none hides another. Never bigger than most of the screen.+ private func startFrame(on screen: NSScreen) -> NSRect {+ let area = screen.visibleFrame+ let fit = min(1, area.width * 0.7 / natural.width, area.height * 0.7 / natural.height)+ let w = natural.width * fit, h = natural.height * fit+ let step = CGFloat((Self.open.count) % 8) * 24+ return NSRect(x: area.midX - w / 2 + step, y: area.midY - h / 2 - step, width: w, height: h)+ }++ /// Zooms keeping the point under the pointer where it is.+ private func zoom(by factor: CGFloat, around anchor: NSPoint) {+ let frame = panel.frame+ let scale = min(max(frame.width * factor / natural.width, 0.1), 4)+ let w = natural.width * scale, h = natural.height * scale+ guard w >= 60, h >= 60 else { return }+ let fx = (anchor.x - frame.minX) / frame.width, fy = (anchor.y - frame.minY) / frame.height+ panel.setFrame(NSRect(x: anchor.x - w * fx, y: anchor.y - h * fy, width: w, height: h), display: true)+ }++ private func actualSize() {+ let frame = panel.frame+ panel.setFrame(NSRect(x: frame.midX - natural.width / 2, y: frame.midY - natural.height / 2,+ width: natural.width, height: natural.height), display: true)+ }++ private func hangBack() {+ let frame = panel.frame+ panel.close()+ Self.open[id] = nil+ onHangBack(id, frame)+ }+}++/// Floats over every app and Space, under the line so it never covers it.+/// A click makes it key without bringing Tendedero to the front, so the app+/// you work in stays active; it then takes Escape and ⌘C.+private final class HeldPanel: NSPanel {+ init(content: NSView) {+ // Resizable from its edges and corners, like any window.+ super.init(contentRect: .zero, styleMask: [.borderless, .nonactivatingPanel, .resizable],+ backing: .buffered, defer: false)+ isOpaque = false+ backgroundColor = .clear+ hasShadow = true+ level = NSWindow.Level(rawValue: NSWindow.Level.floating.rawValue - 1)+ collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .ignoresCycle]+ hidesOnDeactivate = false+ isReleasedWhenClosed = false+ isMovableByWindowBackground = true+ becomesKeyOnlyIfNeeded = false+ contentView = content+ }++ override var canBecomeKey: Bool { true }+ override var canBecomeMain: Bool { false }+}++/// The photo in a glass frame like the cards on the line. Its only control+/// is the button in the corner, which hangs it back, shown on hover like the+/// cards' own; everything else is in its menu.+private final class HeldView: NSVisualEffectView {+ static let border: CGFloat = 6++ var onHangBack: () -> Void = {}+ var onZoom: (CGFloat, NSPoint) -> Void = { _, _ in }+ var onActualSize: () -> Void = {}+ var onCopy: () -> Void = {}+ var onMarkup: () -> Void = {}+ var onQuickLook: () -> Void = {}++ private let photo = CALayer()+ private let hangBackButton = CornerButton(symbol: "arrow.up.to.line")++ init(image: NSImage) {+ super.init(frame: .zero)+ material = .popover+ blendingMode = .behindWindow+ state = .active+ wantsLayer = true+ layer?.cornerRadius = 12+ layer?.masksToBounds = true+ layer?.borderWidth = 0.5+ layer?.borderColor = NSColor.white.withAlphaComponent(0.45).cgColor+ photo.contents = image+ photo.contentsGravity = .resizeAspect+ photo.cornerRadius = 7+ photo.masksToBounds = true+ layer?.addSublayer(photo)+ hangBackButton.alphaValue = 0+ hangBackButton.onPress = { [weak self] in self?.onHangBack() }+ hangBackButton.setAccessibilityLabel(L("Hang back"))+ addSubview(hangBackButton)+ setAccessibilityElement(true)+ setAccessibilityRole(.image)+ }++ required init?(coder: NSCoder) { fatalError() }++ override func layout() {+ super.layout()+ CATransaction.begin()+ CATransaction.setDisableActions(true)+ photo.frame = bounds.insetBy(dx: Self.border, dy: Self.border)+ photo.contentsScale = window?.backingScaleFactor ?? 2+ CATransaction.commit()+ hangBackButton.frame = NSRect(x: 9, y: bounds.height - 29, width: 20, height: 20)+ }++ override func updateTrackingAreas() {+ trackingAreas.forEach(removeTrackingArea)+ addTrackingArea(NSTrackingArea(rect: bounds, options: [.mouseEnteredAndExited, .activeAlways, .inVisibleRect],+ owner: self))+ super.updateTrackingAreas()+ }++ override func mouseEntered(with event: NSEvent) { showButton(true) }+ override func mouseExited(with event: NSEvent) { showButton(false) }++ private func showButton(_ on: Bool) {+ NSAnimationContext.runAnimationGroup { context in+ context.duration = 0.18+ hangBackButton.animator().alphaValue = on ? 1 : 0+ }+ }++ override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }+ override var acceptsFirstResponder: Bool { true }+ override var mouseDownCanMoveWindow: Bool { true }++ override func mouseDown(with event: NSEvent) {+ window?.makeKey()+ window?.makeFirstResponder(self)+ window?.performDrag(with: event)+ }++ override func magnify(with event: NSEvent) {+ guard let window else { return }+ onZoom(1 + event.magnification, NSEvent.mouseLocation.clamped(to: window.frame))+ }++ /// A mouse wheel zooms too: there is nothing to scroll in a photo.+ override func scrollWheel(with event: NSEvent) {+ guard let window, event.scrollingDeltaY != 0 else { return }+ let step = event.hasPreciseScrollingDeltas ? event.scrollingDeltaY * 0.005 : event.scrollingDeltaY * 0.05+ onZoom(1 + step, NSEvent.mouseLocation.clamped(to: window.frame))+ }++ override func keyDown(with event: NSEvent) {+ if event.keyCode == 53 {+ onHangBack()+ } else if event.modifierFlags.contains(.command), event.charactersIgnoringModifiers == "c" {+ onCopy()+ } else {+ super.keyDown(with: event)+ }+ }++ override func rightMouseDown(with event: NSEvent) {+ let menu = NSMenu()+ menu.addItem(ClosureMenuItem(L("Hang back")) { [weak self] in self?.onHangBack() })+ menu.addItem(.separator())+ menu.addItem(ClosureMenuItem(L("Copy")) { [weak self] in self?.onCopy() })+ menu.addItem(ClosureMenuItem(L("Quick Look")) { [weak self] in self?.onQuickLook() })+ menu.addItem(ClosureMenuItem(L("Markup")) { [weak self] in self?.onMarkup() })+ menu.addItem(ClosureMenuItem(L("Actual Size")) { [weak self] in self?.onActualSize() })+ NSMenu.popUpContextMenu(menu, with: event, for: self)+ }+}++/// A small glass disc with a symbol, as on the line's cards.+private final class CornerButton: NSVisualEffectView {+ var onPress: () -> Void = {}++ init(symbol: String) {+ super.init(frame: .zero)+ material = .popover+ blendingMode = .withinWindow+ state = .active+ wantsLayer = true+ layer?.cornerRadius = 10+ layer?.masksToBounds = true+ layer?.borderWidth = 0.5+ layer?.borderColor = NSColor.white.withAlphaComponent(0.5).cgColor+ let icon = NSImageView(image: NSImage(systemSymbolName: symbol, accessibilityDescription: nil)+ ?? NSImage())+ icon.symbolConfiguration = .init(pointSize: 8, weight: .bold)+ icon.contentTintColor = .labelColor+ icon.frame = NSRect(x: 0, y: 0, width: 20, height: 20)+ icon.imageScaling = .scaleNone+ addSubview(icon)+ setAccessibilityElement(true)+ setAccessibilityRole(.button)+ }++ required init?(coder: NSCoder) { fatalError() }++ override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }+ override var mouseDownCanMoveWindow: Bool { false }+ /// The whole disc takes the click, symbol included.+ override func hitTest(_ point: NSPoint) -> NSView? {+ frame.contains(point) ? self : nil+ }+ override func mouseDown(with event: NSEvent) {}+ override func mouseUp(with event: NSEvent) {+ if bounds.contains(convert(event.locationInWindow, from: nil)) { onPress() }+ }+}++private extension NSPoint {+ func clamped(to rect: NSRect) -> NSPoint {+ NSPoint(x: min(max(x, rect.minX), rect.maxX), y: min(max(y, rect.minY), rect.maxY))+ }+}diff --git a/Sources/Tendedero/Line.swift b/Sources/Tendedero/Line.swiftindex c271e38..408f4c2 100644--- a/Sources/Tendedero/Line.swift+++ b/Sources/Tendedero/Line.swift@@ -15,11 +15,19 @@ struct Pegged: Identifiable, Equatable {var falling = false/// Still flying in from where it was captured; the card waits hidden.var flying = false+ /// Pinned, left of the knot: it stays until you take it down.+ var kept = false+ /// Taken off the line to hold in front of you. Its clip waits empty+ /// until it comes back.+ var held = false+ /// Hung from another app with Hang on Tendedero, rather than pinned+ /// from the photos that came and went. Always pinned.+ var byHand = false/// A screen recording rather than a screenshot.var isRecording: Bool { Tendedero.isRecording(url) }static func == (a: Pegged, b: Pegged) -> Bool {- a.id == b.id && a.falling == b.falling && a.flying == b.flying && a.thumb === b.thumb+ a.id == b.id && a.falling == b.falling && a.flying == b.flying && a.kept == b.kept && a.byHand == b.byHand && a.held == b.held && a.thumb === b.thumb}}@@ -66,6 +74,13 @@ final class Line: ObservableObject {var liveCount: Int { items.filter { !$0.falling }.count }+ /// Photos hung by hand. They hang together at the left end of the line,+ /// before the knot, and never fall to make room.+ var keptCount: Int { items.filter { !$0.falling && $0.kept }.count }++ /// The oldest photo that can fall: the first one past the knot.+ private var oldestLoose: Pegged? { items.first { !$0.falling && !$0.kept && !$0.held } }+private let storeKey = "pegged"init() {@@ -88,7 +103,7 @@ final class Line: ObservableObject {// A full line lets the oldest photo fall off the far end. Only one: a// line hung on a wider screen keeps its length here instead of losing// several photos to a single capture.- if liveCount > maxItems, let oldest = items.first(where: { !$0.falling }) {+ if liveCount > maxItems, let oldest = oldestLoose {letGo(oldest.id)}save()@@ -106,6 +121,11 @@ final class Line: ObservableObject {/// over the whole screen.var onFall: ((Pegged) -> Void)?+ /// Hold, from a photo's menu: the app takes it off the line.+ var onHold: ((UUID) -> Void)?+ /// A click on a held photo's faded trace: it comes back.+ var onHangBack: ((UUID) -> Void)?+func drop(_ id: UUID, quietly: Bool = false) {guard let i = items.firstIndex(where: { $0.id == id }), !items[i].falling else { return }onFall?(items[i])@@ -134,16 +154,17 @@ final class Line: ObservableObject {items.removeAll { $0.falling }}- /// "Take everything down": every photo goes the way of its corner cross.+ /// "Take everything down": every photo past the knot goes the way of its+ /// corner cross. What you hung by hand stays.func clear() {- takeDown(items.filter { !$0.falling })+ takeDown(items.filter { !$0.falling && !$0.kept && !$0.held })}/// The photos hung before (left) or after (right) this one.func neighbours(of id: UUID, toTheLeft: Bool) -> [Pegged] {let live = items.filter { !$0.falling }guard let i = live.firstIndex(where: { $0.id == id }) else { return [] }- return toTheLeft ? Array(live[..<i]) : Array(live[(i + 1)...])+ return (toTheLeft ? Array(live[..<i]) : Array(live[(i + 1)...])).filter { !$0.kept && !$0.held }}/// Takes down everything on one side of a photo. Each one goes the way@@ -230,7 +251,7 @@ final class Line: ObservableObject {if soundOn && !quietly { Line.trashSound?.play() }drop(id, quietly: true)if let step, let index {- remember(TakenDown(url: item.url, index: index, trashed: trashed as URL?), in: step)+ remember(TakenDown(url: item.url, index: index, trashed: trashed as URL?, kept: item.kept, byHand: item.byHand), in: step)}return true} catch {@@ -252,13 +273,35 @@ final class Line: ObservableObject {return item.url.standardizedFileURL.path.hasPrefix(Inbox.folder.standardizedFileURL.path + "/")}- /// The corner cross and "Take down" both end up here.+ /// What the button in a photo's corner does.+ enum Corner {+ /// A file in Tendedero's folder: to the Trash.+ case trash+ /// A file anywhere else, or hung by hand: off the line, file untouched.+ case hide+ /// Pinned from the photos that come and go: back among them.+ case unpin+ }++ func corner(of id: UUID) -> Corner {+ guard let item = items.first(where: { $0.id == id }) else { return .hide }+ if item.kept { return item.byHand ? .hide : .unpin }+ return isInInbox(id) ? .trash : .hide+ }++ /// The button in the corner.+ func pressCorner(_ id: UUID) {+ if corner(of: id) == .unpin { unpin(id) } else { discard(id) }+ }++ /// The corner cross and "Take down" both end up here. A pinned photo is+ /// never sent to the Trash: it only leaves the line.func discard(_ id: UUID, quietly: Bool = false, step: UUID = UUID()) {- if isInInbox(id) {+ if isInInbox(id), items.first(where: { $0.id == id })?.kept == false {trash(id, quietly: quietly, step: step)} else if let item = items.first(where: { $0.id == id && !$0.falling }), let index = liveIndex(of: id) {drop(id, quietly: quietly)- remember(TakenDown(url: item.url, index: index, trashed: nil), in: step)+ remember(TakenDown(url: item.url, index: index, trashed: nil, kept: item.kept, byHand: item.byHand), in: step)}}@@ -272,7 +315,7 @@ final class Line: ObservableObject {/// After Keep on line is lowered, the oldest photos past it go the way/// of a full line.func trim() {- while liveCount > maxItems, let oldest = items.first(where: { !$0.falling }) {+ while liveCount > maxItems, let oldest = oldestLoose {letGo(oldest.id)}scroll = 0@@ -358,6 +401,8 @@ final class Line: ObservableObject {let url: URLlet index: Intlet trashed: URL?+ var kept = false+ var byHand = false}/// What was taken down, the latest last. A step holds everything one@@ -385,7 +430,9 @@ final class Line: ObservableObject {for photo in step.photos.reversed() {guard let url = restore(photo), !items.contains(where: { $0.url == url && !$0.falling }),let thumb = makeThumbnail(url) else { continue }- let item = Pegged(url: url, thumb: thumb)+ var item = Pegged(url: url, thumb: thumb)+ item.kept = photo.kept+ item.byHand = photo.byHandlet live = items.filter { !$0.falling }if let gap = items.firstIndex(where: { $0.falling && $0.url == photo.url }) {// Its empty place is still on the line: it hangs back there.@@ -403,9 +450,10 @@ final class Line: ObservableObject {}// As when something new hangs, a full line lets its oldest photo go,// never one that just came back.- while liveCount > maxItems, let oldest = items.first(where: { !$0.falling && !back.contains($0.id) }) {+ while liveCount > maxItems, let oldest = items.first(where: { !$0.falling && !$0.kept && !back.contains($0.id) }) {letGo(oldest.id)}+ keepKeptFirst()save()play("Tink", volume: 0.35)}@@ -433,6 +481,67 @@ final class Line: ObservableObject {items.filter { !$0.falling }.firstIndex { $0.id == id }}+ // MARK: Hanging by hand++ /// Kept photos hang left of the knot, the rest after it, each side in+ /// its own order.+ private func keepKeptFirst() {+ let kept = items.filter { $0.kept && !$0.falling }+ if items.prefix(kept.count).map(\.id) != kept.map(\.id) {+ items = kept + items.filter { !($0.kept && !$0.falling) }+ }+ }++ /// Pin: the photo joins the kept ones at the left end of the line.+ func pin(_ id: UUID) {+ guard let i = items.firstIndex(where: { $0.id == id && !$0.falling && !$0.kept }) else { return }+ var item = items.remove(at: i)+ item.kept = true+ items.insert(item, at: keptCount)+ save()+ play("Tink", volume: 0.35)+ }++ /// Unpin: it hangs loose again, first past the kept ones, so it is the+ /// next to fall from a full line.+ func unpin(_ id: UUID) {+ guard let i = items.firstIndex(where: { $0.id == id && !$0.falling && $0.kept && !$0.byHand }) else { return }+ var item = items.remove(at: i)+ item.kept = false+ items.insert(item, at: keptCount)+ save()+ }++ /// An image hung from another app, with Hang on Tendedero. Like a+ /// photo from a watched folder, the line only shows the file where it+ /// is: taking it down leaves the file alone. What you hang yourself is+ /// pinned.+ @discardableResult+ func hangKept(_ url: URL) -> Bool {+ // Already on the line: it is pinned where it is.+ if let hanging = items.first(where: { $0.url.standardizedFileURL == url.standardizedFileURL && !$0.falling }) {+ pin(hanging.id)+ return true+ }+ guard let id = hang(url),+ let i = items.firstIndex(where: { $0.id == id }) else { return false }+ var item = items.remove(at: i)+ item.kept = true+ item.byHand = true+ items.insert(item, at: keptCount)+ save()+ return true+ }++ // MARK: Holding++ /// Off the line and into your hand, or back onto its clip.+ func setHeld(_ id: UUID, _ held: Bool) {+ guard let i = items.firstIndex(where: { $0.id == id && !$0.falling }) else { return }+ items[i].held = held+ if !held { items[i].flying = true }+ }+// MARK: Breeze/// Every so often a little wind moves the line. It is the detail that@@ -447,9 +556,14 @@ final class Line: ObservableObject {// MARK: Persistence+ private let keptKey = "kept"+ private let byHandKey = "byHand"+private func save() {- let paths = items.filter { !$0.falling }.map(\.url.path)- UserDefaults.standard.set(paths, forKey: storeKey)+ let live = items.filter { !$0.falling }+ UserDefaults.standard.set(live.map(\.url.path), forKey: storeKey)+ UserDefaults.standard.set(live.filter(\.kept).map(\.url.path), forKey: keptKey)+ UserDefaults.standard.set(live.filter(\.byHand).map(\.url.path), forKey: byHandKey)}/// Everything comes back as it was. This runs before the line knows its@@ -457,11 +571,17 @@ final class Line: ObservableObject {/// `hang` would let photos fall off a wide screen's line at every launch.private func restore() {let paths = UserDefaults.standard.stringArray(forKey: storeKey) ?? []+ let kept = Set(UserDefaults.standard.stringArray(forKey: keptKey) ?? [])+ let byHand = Set(UserDefaults.standard.stringArray(forKey: byHandKey) ?? [])for path in paths where FileManager.default.fileExists(atPath: path) {let url = URL(fileURLWithPath: path)guard !items.contains(where: { $0.url == url }), let thumb = makeThumbnail(url) else { continue }- items.append(Pegged(url: url, thumb: thumb))+ var item = Pegged(url: url, thumb: thumb)+ item.byHand = byHand.contains(path)+ item.kept = kept.contains(path) || item.byHand+ items.append(item)}+ keepKeptFirst()}// MARK: Helpersdiff --git a/Sources/Tendedero/LineView.swift b/Sources/Tendedero/LineView.swiftindex 359bfe4..f78d57f 100644--- a/Sources/Tendedero/LineView.swift+++ b/Sources/Tendedero/LineView.swift@@ -68,6 +68,12 @@ struct LineView: View {.transition(.opacity)}+ if let x = knotX(width: width) {+ Knot()+ .position(x: x, y: Layout.ropeY(x: x, width: width) + 0.5)+ .transition(.opacity)+ }+ForEach(Array(line.items.enumerated()), id: \.element.id) { index, item inlet x = Layout.x(index: index, count: line.items.count, width: width,visible: line.visibleCount, scroll: line.scroll)@@ -81,6 +87,7 @@ struct LineView: View {}.animation(.spring(response: 0.55, dampingFraction: 0.78), value: line.items.map(\.id)).animation(.easeInOut(duration: 0.3), value: line.items.isEmpty)+ .animation(.spring(response: 0.55, dampingFraction: 0.78), value: line.items.map(\.kept))// Tucked away, the whole line waits above the top edge and slides// out from under the menu bar, the way an auto-hiding Dock does..offset(y: line.revealed ? 0 : -(Layout.panelHeight + 12))@@ -91,6 +98,40 @@ struct LineView: View {line.hitRects = rects}}++ /// Halfway between the last pinned photo and the next one, or half a+ /// step past it when nothing hangs loose. The empty place a pinned photo+ /// leaves still counts, so the knot stays put until the gaps close.+ private func knotX(width: CGFloat) -> CGFloat? {+ guard let last = line.items.lastIndex(where: \.kept) else { return nil }+ let x = { (i: Int) in Layout.x(index: i, count: line.items.count, width: width,+ visible: line.visibleCount, scroll: line.scroll) }+ let next = last + 1 < line.items.count ? x(last + 1) : x(last) + Layout.spacing+ return (x(last) + next) / 2+ }+}++/// Where the line is tied: what hangs left of it is pinned and stays.+private struct Knot: View {+ var body: some View {+ ZStack {+ Ellipse()+ .fill(Color(white: 0.5))+ .frame(width: 7, height: 5.5)+ .shadow(color: .black.opacity(0.25), radius: 1, y: 1)+ // Two short loose ends hanging from it.+ Path { p in+ p.move(to: CGPoint(x: 3.5, y: 3))+ p.addQuadCurve(to: CGPoint(x: 1.5, y: 11), control: CGPoint(x: 3.8, y: 7))+ p.move(to: CGPoint(x: 4, y: 3))+ p.addQuadCurve(to: CGPoint(x: 6.5, y: 10), control: CGPoint(x: 4.5, y: 7))+ }+ .stroke(Color(white: 0.55), style: StrokeStyle(lineWidth: 1, lineCap: .round))+ .frame(width: 8, height: 12)+ .offset(y: 5)+ }+ .allowsHitTesting(false)+ }}private struct Hint: View {diff --git a/Sources/Tendedero/PeggedView.swift b/Sources/Tendedero/PeggedView.swiftindex e25d9dc..13306c5 100644--- a/Sources/Tendedero/PeggedView.swift+++ b/Sources/Tendedero/PeggedView.swift@@ -12,13 +12,25 @@ struct PeggedView: View {private var copied: Bool { line.copiedID == item.id }private var dragging: Bool { line.draggingID == item.id }++ private var cornerSymbol: String {+ switch line.corner(of: item.id) {+ case .trash: "xmark"+ case .hide: "eye.slash"+ case .unpin: "pin.slash"+ }+ }private var pressed: Bool { line.pressedID == item.id }var body: some View {VStack(spacing: -12) {- Clothespin()+ Clothespin(pinned: item.kept).zIndex(1)+ // Held in your hand: a faded trace of it waits on its clip.card+ .saturation(item.held ? 0 : 1)+ .opacity(item.held ? 0.3 : 1)+ .animation(.easeOut(duration: 0.25), value: item.held)}.rotationEffect(.degrees(swing + item.tilt), anchor: .top).offset(y: arrived ? 0 : -46)@@ -87,14 +99,15 @@ struct PeggedView: View {.overlay(alignment: .topLeading) {// Drawn here, clicked through GrabView, which sits on top. A// cross sends a file in Tendedero's folder to the Trash; for a- // file anywhere else it only hides it from the line.- Image(systemName: line.isInInbox(item.id) ? "xmark" : "eye.slash")+ // file anywhere else, or one hung by hand, it only hides it+ // from the line. A pinned photo is unpinned instead.+ Image(systemName: cornerSymbol).font(.system(size: 8, weight: .bold)).foregroundStyle(.primary).frame(width: 20, height: 20).glassFrame(circle: true).padding(3)- .opacity(hovering && !dragging ? 1 : 0)+ .opacity(hovering && !dragging && !item.held ? 1 : 0).scaleEffect(hovering ? 1 : 0.6).allowsHitTesting(false)}@@ -182,6 +195,10 @@ extension View {/// A minimal aluminium clip: a brushed metal pill with a slot where it/// grips the line, and a soft shadow so it reads on any background.struct Clothespin: View {+ /// Silver for what comes and goes, space grey for what you pinned, the+ /// way Macs come in both: what stays on the line reads at a glance.+ var pinned = false+private let metal = LinearGradient(stops: [.init(color: Color(white: 0.70), location: 0),@@ -191,20 +208,29 @@ struct Clothespin: View {],startPoint: .leading, endPoint: .trailing)+ private let spaceGrey = LinearGradient(+ stops: [+ .init(color: Color(white: 0.30), location: 0),+ .init(color: Color(white: 0.47), location: 0.35),+ .init(color: Color(white: 0.38), location: 0.65),+ .init(color: Color(white: 0.24), location: 1),+ ],+ startPoint: .leading, endPoint: .trailing)+var body: some View {RoundedRectangle(cornerRadius: 3.5, style: .continuous)- .fill(metal)+ .fill(pinned ? spaceGrey : metal).frame(width: 9, height: 26).overlay(RoundedRectangle(cornerRadius: 3.5, style: .continuous)- .stroke(LinearGradient(colors: [Color.white.opacity(0.9), Color.black.opacity(0.18)],+ .stroke(LinearGradient(colors: [Color.white.opacity(pinned ? 0.45 : 0.9), Color.black.opacity(0.18)],startPoint: .top, endPoint: .bottom),lineWidth: 0.6)).overlay(alignment: .top) {// The slot the line passes through.Capsule()- .fill(Color.black.opacity(0.32))+ .fill(Color.black.opacity(pinned ? 0.55 : 0.32)).frame(width: 5, height: 1.4).padding(.top, 8.5)}diff --git a/Sources/Tendedero/Resources/az.lproj/Localizable.strings b/Sources/Tendedero/Resources/az.lproj/Localizable.stringsindex a25c81b..c8e510d 100644--- a/Sources/Tendedero/Resources/az.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/az.lproj/Localizable.strings@@ -67,3 +67,11 @@/* PeggedView */"Copied" = "Kopyalandı";++/* Pinning and holding photos */+"Pin" = "Bərkit";+"Unpin" = "Bərkitməni götür";+"Hold" = "Əldə saxla";+"Hang back" = "İpə qaytar";+"Hang everything back" = "Hamısını ipə qaytar";+"Actual Size" = "Həqiqi ölçü";diff --git a/Sources/Tendedero/Resources/az.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/az.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..dbfca37--- /dev/null+++ b/Sources/Tendedero/Resources/az.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Tendedero-ya as";diff --git a/Sources/Tendedero/Resources/en.lproj/Localizable.strings b/Sources/Tendedero/Resources/en.lproj/Localizable.stringsindex 5b4f655..5824e59 100644--- a/Sources/Tendedero/Resources/en.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/en.lproj/Localizable.strings@@ -67,3 +67,11 @@/* PeggedView */"Copied" = "Copied";++/* Pinning and holding photos */+"Pin" = "Pin";+"Unpin" = "Unpin";+"Hold" = "Hold";+"Hang back" = "Hang back";+"Hang everything back" = "Hang everything back";+"Actual Size" = "Actual Size";diff --git a/Sources/Tendedero/Resources/en.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/en.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..a6b824c--- /dev/null+++ b/Sources/Tendedero/Resources/en.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Hang on Tendedero";diff --git a/Sources/Tendedero/Resources/es.lproj/Localizable.strings b/Sources/Tendedero/Resources/es.lproj/Localizable.stringsindex 2123660..162655e 100644--- a/Sources/Tendedero/Resources/es.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/es.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "Copiado";++/* Pinning and holding photos */+"Pin" = "Fijar";+"Unpin" = "Dejar de fijar";+"Hold" = "Sostener";+"Hang back" = "Devolver a la cuerda";+"Hang everything back" = "Devolver todo a la cuerda";+"Actual Size" = "Tamaño real";diff --git a/Sources/Tendedero/Resources/es.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/es.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..d705307--- /dev/null+++ b/Sources/Tendedero/Resources/es.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Colgar en Tendedero";diff --git a/Sources/Tendedero/Resources/fr.lproj/Localizable.strings b/Sources/Tendedero/Resources/fr.lproj/Localizable.stringsindex 8d99847..e6092f3 100644--- a/Sources/Tendedero/Resources/fr.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/fr.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "Copié";++/* Pinning and holding photos */+"Pin" = "Épingler";+"Unpin" = "Désépingler";+"Hold" = "Garder en main";+"Hang back" = "Remettre sur la corde";+"Hang everything back" = "Tout remettre sur la corde";+"Actual Size" = "Taille réelle";diff --git a/Sources/Tendedero/Resources/fr.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/fr.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..dddc25d--- /dev/null+++ b/Sources/Tendedero/Resources/fr.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Accrocher dans Tendedero";diff --git a/Sources/Tendedero/Resources/gl.lproj/Localizable.strings b/Sources/Tendedero/Resources/gl.lproj/Localizable.stringsindex 71854a5..c0f32f0 100644--- a/Sources/Tendedero/Resources/gl.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/gl.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "Copiado";++/* Pinning and holding photos */+"Pin" = "Fixar";+"Unpin" = "Deixar de fixar";+"Hold" = "Suxeitar";+"Hang back" = "Devolver á corda";+"Hang everything back" = "Devolver todo á corda";+"Actual Size" = "Tamaño real";diff --git a/Sources/Tendedero/Resources/gl.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/gl.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..19d6376--- /dev/null+++ b/Sources/Tendedero/Resources/gl.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Pendurar en Tendedero";diff --git a/Sources/Tendedero/Resources/hi.lproj/Localizable.strings b/Sources/Tendedero/Resources/hi.lproj/Localizable.stringsindex 3e7f5aa..bea4d88 100644--- a/Sources/Tendedero/Resources/hi.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/hi.lproj/Localizable.strings@@ -67,3 +67,11 @@/* PeggedView */"Copied" = "कॉपी हो गया";++/* Pinning and holding photos */+"Pin" = "पिन करें";+"Unpin" = "पिन हटाएँ";+"Hold" = "हाथ में लें";+"Hang back" = "रस्सी पर लौटाएँ";+"Hang everything back" = "सब रस्सी पर लौटाएँ";+"Actual Size" = "असली आकार";diff --git a/Sources/Tendedero/Resources/hi.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/hi.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..605b16d--- /dev/null+++ b/Sources/Tendedero/Resources/hi.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Tendedero पर टाँगें";diff --git a/Sources/Tendedero/Resources/ja.lproj/Localizable.strings b/Sources/Tendedero/Resources/ja.lproj/Localizable.stringsindex 42ca2dc..0ad7616 100644--- a/Sources/Tendedero/Resources/ja.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/ja.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "コピーしました";++/* Pinning and holding photos */+"Pin" = "ピン留め";+"Unpin" = "ピン留めを外す";+"Hold" = "手に取る";+"Hang back" = "ロープに戻す";+"Hang everything back" = "すべてロープに戻す";+"Actual Size" = "実際のサイズ";diff --git a/Sources/Tendedero/Resources/ja.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/ja.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..252d423--- /dev/null+++ b/Sources/Tendedero/Resources/ja.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Tendederoに吊るす";diff --git a/Sources/Tendedero/Resources/ko.lproj/Localizable.strings b/Sources/Tendedero/Resources/ko.lproj/Localizable.stringsindex fe2e6be..2efb3de 100644--- a/Sources/Tendedero/Resources/ko.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/ko.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "복사됨";++/* Pinning and holding photos */+"Pin" = "고정하기";+"Unpin" = "고정 해제";+"Hold" = "손에 들기";+"Hang back" = "줄에 돌려놓기";+"Hang everything back" = "모두 줄에 돌려놓기";+"Actual Size" = "실제 크기";diff --git a/Sources/Tendedero/Resources/ko.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/ko.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..312db27--- /dev/null+++ b/Sources/Tendedero/Resources/ko.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Tendedero에 걸기";diff --git a/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings b/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.stringsindex 863ee08..da6fa40 100644--- a/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "Copiado";++/* Pinning and holding photos */+"Pin" = "Fixar";+"Unpin" = "Desafixar";+"Hold" = "Segurar";+"Hang back" = "Devolver ao varal";+"Hang everything back" = "Devolver tudo ao varal";+"Actual Size" = "Tamanho real";diff --git a/Sources/Tendedero/Resources/pt-BR.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/pt-BR.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..cedb054--- /dev/null+++ b/Sources/Tendedero/Resources/pt-BR.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Pendurar no Tendedero";diff --git a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings b/Sources/Tendedero/Resources/tr.lproj/Localizable.stringsindex 4acd4bc..eea1288 100644--- a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/tr.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "Kopyalandı";++/* Pinning and holding photos */+"Pin" = "Sabitle";+"Unpin" = "Sabitlemeyi kaldır";+"Hold" = "Elinde tut";+"Hang back" = "İpe geri koy";+"Hang everything back" = "Hepsini ipe geri koy";+"Actual Size" = "Gerçek boyut";diff --git a/Sources/Tendedero/Resources/tr.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/tr.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..0fe3638--- /dev/null+++ b/Sources/Tendedero/Resources/tr.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "Tendedero’ya as";diff --git a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.stringsindex c9b55dc..6b9821b 100644--- a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings@@ -65,3 +65,11 @@/* PeggedView */"Copied" = "已复制";++/* Pinning and holding photos */+"Pin" = "固定";+"Unpin" = "取消固定";+"Hold" = "拿在手上";+"Hang back" = "放回绳上";+"Hang everything back" = "全部放回绳上";+"Actual Size" = "实际大小";diff --git a/Sources/Tendedero/Resources/zh-Hans.lproj/ServicesMenu.strings b/Sources/Tendedero/Resources/zh-Hans.lproj/ServicesMenu.stringsnew file mode 100644index 0000000..b71b3d8--- /dev/null+++ b/Sources/Tendedero/Resources/zh-Hans.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* The service in the menu of images in Finder and other apps. */+"Hang on Tendedero" = "挂到 Tendedero";diff --git a/docs/i18n/README.az.md b/docs/i18n/README.az.mdindex f29a073..9919136 100644--- a/docs/i18n/README.az.md+++ b/docs/i18n/README.az.md@@ -57,6 +57,9 @@ Göstəricini menyu panelinin ortasında saxlayın, ip aşağı enir. Uzaqlaşd| Qovluğa sürükləmək | Orada saxlanır və ipdən çıxır. || Zibil qutusuna sürükləmək və ya çarpaza klik | Ondan qurtulursunuz. || Göstərici ipin üstündəykən <kbd>⌘</kbd> <kbd>Z</kbd> | Atdığınızı ipə geri asır. |+| Sağ klik, Bərkit | Saxlayın: düyünün solunda kosmik boz sancaqla asılır və yeni ekran şəkilləri onu itələmir. |+| Sağ klik, Əldə saxla | İpdən götürün və işləyərkən qarşınızda saxlayın. |+| Finder-də şəklə sağ klik, Tendedero-ya as | İstənilən şəkli ipə bərkidilmiş halda asın. || Göstəricini menyu panelinin ortasında saxlamaq | İpi həmin ekranda endirir. || Menyu panelində istənilən yerə klik | İpi yığır. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | İpi göstərir və ya gizlədir. Menyu panelində Qısayol bölməsindən dəyişdirmək olar. |diff --git a/docs/i18n/README.es.md b/docs/i18n/README.es.mdindex 90031b8..d45724c 100644--- a/docs/i18n/README.es.md+++ b/docs/i18n/README.es.md@@ -57,6 +57,9 @@ Lleva el puntero al centro de la barra de menús y la cuerda baja. Apártalo y d| Arrastrar a una carpeta | Se queda ahí y sale de la cuerda. || Arrastrar a la Papelera o hacer clic en la cruz | Te deshaces de ella. || <kbd>⌘</kbd> <kbd>Z</kbd> con el puntero en la cuerda | Vuelve a colgar lo que acabas de soltar. |+| Clic derecho y Fijar | Guárdala: cuelga a la izquierda del nudo con una pinza gris espacial y ninguna captura nueva la empuja. |+| Clic derecho y Sostener | Quítala de la cuerda y tenla delante mientras trabajas. |+| En el Finder, clic derecho en una imagen y Colgar en Tendedero | Cuelga cualquier imagen en la cuerda, fijada. || Dejar el puntero en el centro de la barra de menús | Baja la cuerda en esa pantalla. || Hacer clic en cualquier sitio de la barra de menús | Recoge la cuerda. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | Muestra u oculta la cuerda. Se cambia en Atajo, en la barra de menús. |diff --git a/docs/i18n/README.fr.md b/docs/i18n/README.fr.mdindex f7a55a7..c2543e8 100644--- a/docs/i18n/README.fr.md+++ b/docs/i18n/README.fr.md@@ -57,6 +57,9 @@ Posez le pointeur au milieu de la barre des menus et la corde descend. Éloignez| Glisser dans un dossier | Elle y reste. Elle quitte la corde. || Glisser dans la corbeille, ou cliquer sur la croix | Laissez-la filer. || <kbd>⌘</kbd> <kbd>Z</kbd>, le pointeur sur la corde | Raccroche ce que vous venez de laisser filer. |+| Clic droit, puis Épingler | Gardez-la : elle pend à gauche du nœud avec une pince gris sidéral, et aucune nouvelle capture ne la pousse. |+| Clic droit, puis Garder en main | Décrochez-la et gardez-la devant vous pendant que vous travaillez. |+| Dans le Finder, clic droit sur une image, puis Accrocher dans Tendedero | Accrochez n’importe quelle image à la corde, épinglée. || Poser le pointeur au milieu de la barre des menus | Fait descendre la corde sur cet écran. || Cliquer n’importe où dans la barre des menus | La range. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | Affiche ou masque la corde. Modifiable dans Raccourci, dans la barre des menus. |diff --git a/docs/i18n/README.gl.md b/docs/i18n/README.gl.mdindex 486c660..d08c81a 100644--- a/docs/i18n/README.gl.md+++ b/docs/i18n/README.gl.md@@ -57,6 +57,9 @@ Leva o punteiro ao centro da barra de menús e a corda baixa. Apártao e desapar| Arrastrar a un cartafol | Queda alí e sae da corda. || Arrastrar á Papeleira ou facer clic na cruz | Desfaste dela. || <kbd>⌘</kbd> <kbd>Z</kbd> co punteiro na corda | Volve colgar o que acabas de soltar. |+| Clic dereito e Fixar | Gárdaa: pendura á esquerda do nó cunha pinza gris espacial e ningunha captura nova a empurra. |+| Clic dereito e Suxeitar | Quítaa da corda e tena diante mentres traballas. |+| No Finder, clic dereito nunha imaxe e Pendurar en Tendedero | Pendura calquera imaxe na corda, fixada. || Deixar o punteiro no centro da barra de menús | Baixa a corda nesa pantalla. || Facer clic en calquera sitio da barra de menús | Recolle a corda. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | Amosa ou oculta a corda. Cámbiase en Atallo, na barra de menús. |diff --git a/docs/i18n/README.hi.md b/docs/i18n/README.hi.mdindex ec346a4..d62a154 100644--- a/docs/i18n/README.hi.md+++ b/docs/i18n/README.hi.md@@ -57,6 +57,9 @@| किसी फ़ोल्डर में खींचें | उसे वहीं रखें। वह रस्सी से उतर जाती है। || ट्रैश में खींचें, या क्रॉस पर क्लिक करें | जाने दें। || पॉइंटर रस्सी पर रखकर <kbd>⌘</kbd> <kbd>Z</kbd> | जिसे अभी जाने दिया, उसे वापस टाँगें। |+| राइट क्लिक, फिर पिन करें | इसे रखें: यह गाँठ के बाईं ओर स्पेस ग्रे क्लिप पर टँगा रहता है, और कोई नया स्क्रीनशॉट इसे नहीं हटाता। |+| राइट क्लिक, फिर हाथ में लें | इसे रस्सी से उतारें और काम करते समय सामने रखें। |+| Finder में किसी तस्वीर पर राइट क्लिक, फिर Tendedero पर टाँगें | कोई भी तस्वीर रस्सी पर पिन करके टाँगें। || पॉइंटर को मेनू बार के बीच में रोकें | उस स्क्रीन पर रस्सी नीचे लाएँ। || मेनू बार में कहीं भी क्लिक करें | रस्सी ऊपर कर दें। || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | रस्सी दिखाएँ या छिपाएँ। मेनू बार में शॉर्टकट से इसे बदलें। |diff --git a/docs/i18n/README.ja.md b/docs/i18n/README.ja.mdindex 9784e18..2022b66 100644--- a/docs/i18n/README.ja.md+++ b/docs/i18n/README.ja.md@@ -57,6 +57,9 @@| フォルダにドラッグ | そこに保存。ロープからは外れます。 || ゴミ箱にドラッグ、または×をクリック | 手放す。 || ポインタをロープに置いて <kbd>⌘</kbd> <kbd>Z</kbd> | 手放したばかりのものを掛け直す。 |+| 右クリックして「ピン留め」 | 残しておく。結び目の左にスペースグレイのクリップで吊るされ、新しいスクリーンショットに押し出されない。 |+| 右クリックして「手に取る」 | ロープから外して、作業中も目の前に置いておく。 |+| Finderで画像を右クリックして「Tendederoに吊るす」 | どんな画像もピン留めしてロープに吊るす。 || メニューバーの中央にポインタを置く | その画面にロープを降ろす。 || メニューバーのどこかをクリック | ロープをしまう。 || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | ロープを表示または非表示。メニューバーの「ショートカット」で変更できます。 |diff --git a/docs/i18n/README.ko.md b/docs/i18n/README.ko.mdindex b817ebc..546d198 100644--- a/docs/i18n/README.ko.md+++ b/docs/i18n/README.ko.md@@ -57,6 +57,9 @@| 폴더로 드래그 | 폴더에 보관해요. 빨랫줄에서는 사라져요. || 휴지통으로 드래그하거나 X 버튼 클릭 | 미련 없이 버려요. || 포인터를 빨랫줄에 두고 <kbd>⌘</kbd> <kbd>Z</kbd> | 방금 버린 걸 다시 걸어요. |+| 오른쪽 클릭 후 고정하기 | 남겨 둬요. 매듭 왼쪽에 스페이스 그레이 집게로 걸리고, 새 스크린샷에 밀려나지 않아요. |+| 오른쪽 클릭 후 손에 들기 | 줄에서 내려 작업하는 동안 눈앞에 둬요. |+| Finder에서 이미지를 오른쪽 클릭 후 Tendedero에 걸기 | 어떤 이미지든 고정해서 줄에 걸어요. || 포인터를 메뉴 막대 가운데에 올려 두기 | 그 화면에 빨랫줄을 내려요. || 메뉴 막대의 아무 곳이나 클릭 | 빨랫줄을 치워요. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | 빨랫줄을 보거나 가려요. 메뉴 막대의 단축키에서 바꿀 수 있어요. |diff --git a/docs/i18n/README.pt-BR.md b/docs/i18n/README.pt-BR.mdindex a5d8ef8..77f270e 100644--- a/docs/i18n/README.pt-BR.md+++ b/docs/i18n/README.pt-BR.md@@ -57,6 +57,9 @@ Pare o ponteiro no meio da barra de menus e o varal desce. Afaste-o e ele some.| Arrastar para uma pasta | Guarda a imagem ali. Ela sai do varal. || Arrastar para o Lixo, ou clicar no X | Desapegue. || <kbd>⌘</kbd> <kbd>Z</kbd> com o ponteiro no varal | Pendura de volta o que você acabou de soltar. |+| Clique com o botão direito e Fixar | Guarde-a: fica à esquerda do nó com um prendedor cinza-espacial, e nenhuma captura nova a empurra. |+| Clique com o botão direito e Segurar | Tire-a do varal e mantenha-a à sua frente enquanto trabalha. |+| No Finder, clique com o botão direito numa imagem e Pendurar no Tendedero | Pendure qualquer imagem no varal, fixada. || Parar o ponteiro no meio da barra de menus | Baixa o varal naquela tela. || Clicar em qualquer lugar da barra de menus | Recolhe o varal. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | Mostra ou oculta o varal. Altere em Atalho, na barra de menus. |diff --git a/docs/i18n/README.tr.md b/docs/i18n/README.tr.mdindex 8803fa9..a72fa19 100644--- a/docs/i18n/README.tr.md+++ b/docs/i18n/README.tr.md@@ -57,6 +57,9 @@ Aldığınız her ekran görüntüsü, ekranınızın hemen üstündeki bir ipe| Klasöre sürükle | Orada saklar. İpten ayrılır. || Çöp Kutusu'na sürükle ya da çarpıya tıkla | Siler. || İşaretçi ipin üzerindeyken <kbd>⌘</kbd> <kbd>Z</kbd> | Az önce bıraktığını geri asar. |+| Sağ tıkla, Sabitle | Sakla: düğümün solunda uzay grisi bir mandalla asılı kalır, yeni ekran görüntüleri onu itmez. |+| Sağ tıkla, Elinde tut | İpten al ve çalışırken önünde tut. |+| Finder’da bir görsele sağ tıkla, Tendedero’ya as | Herhangi bir görseli ipe sabitlenmiş olarak as. || İşaretçiyi menü çubuğunun ortasında bırak | O ekranda ipi aşağı indirir. || Menü çubuğunda herhangi bir yere tıkla | İpi geri kaldırır. || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | İpi gösterir ya da gizler. Menü çubuğundaki Kısayol bölümünden değiştirilebilir. |diff --git a/docs/i18n/README.zh-Hans.md b/docs/i18n/README.zh-Hans.mdindex cf282e4..c76728d 100644--- a/docs/i18n/README.zh-Hans.md+++ b/docs/i18n/README.zh-Hans.md@@ -57,6 +57,9 @@| 拖进文件夹 | 存在那儿。原图从绳上取下。 || 拖到废纸篓,或点叉 | 松手丢弃。 || 指针在绳子上时按 <kbd>⌘</kbd> <kbd>Z</kbd> | 把刚丢掉的挂回去。 |+| 右键点按,选“固定” | 留住它:它挂在绳结左边,用深空灰夹子夹着,新截图不会把它挤掉。 |+| 右键点按,选“拿在手上” | 从绳上取下,工作时一直放在眼前。 |+| 在“访达”中右键点按图片,选“挂到 Tendedero” | 把任何图片固定挂到绳上。 || 指针停在菜单栏中间 | 在那一块屏幕上放下绳子。 || 点击菜单栏任意处 | 把绳子收起来。 || <kbd>⌃</kbd> <kbd>⌥</kbd> <kbd>T</kbd> | 显示或隐藏绳子。可在菜单栏的「快捷键」中更改。 |diff --git a/scripts/build-app.sh b/scripts/build-app.shindex 4398b2d..e74ff56 100755--- a/scripts/build-app.sh+++ b/scripts/build-app.sh@@ -80,6 +80,16 @@ cat > "$APP/Contents/Info.plist" <<PLIST<string>Tendedero watches the folder you chose so it can hang new images on the line.</string><key>NSDownloadsFolderUsageDescription</key><string>Tendedero watches the folder you chose so it can hang new images on the line.</string>+ <key>NSServices</key>+ <array>+ <dict>+ <key>NSMenuItem</key><dict><key>default</key><string>Hang on Tendedero</string></dict>+ <key>NSMessage</key><string>hangOnLine</string>+ <key>NSPortName</key><string>Tendedero</string>+ <key>NSRequiredContext</key><dict/>+ <key>NSSendFileTypes</key><array><string>public.image</string></array>+ </dict>+ </array></dict></plist>PLIST