Screenshots, hung out to dry. A tiny native macOS app that hangs every screenshot on a line at the top of your screen.
Swift
Move everything to the right of a photo to the Trash (#38)
nijataliyev799843c778cbe
diff --git a/Sources/Tendedero/GrabArea.swift b/Sources/Tendedero/GrabArea.swiftindex 0bd4c36..01a1693 100644--- a/Sources/Tendedero/GrabArea.swift+++ b/Sources/Tendedero/GrabArea.swift@@ -45,6 +45,8 @@ struct GrabArea: NSViewRepresentable {view.onPressChange = { pressed in line.pressedID = pressed ? id : nil }view.menuProvider = {let menu = NSMenu()+ // Items say themselves whether they can be used.+ menu.autoenablesItems = falsemenu.addItem(ClosureMenuItem(L("Copy")) { line.copy(id) })menu.addItem(ClosureMenuItem(L("Open")) { line.open(id) })menu.addItem(ClosureMenuItem(L("Quick Look")) { line.quickLook(id) })@@ -63,6 +65,12 @@ struct GrabArea: NSViewRepresentable {menu.addItem(ClosureMenuItem(L("Take down")) { line.discard(id) })menu.addItem(ClosureMenuItem(L("Move to Trash")) { line.trash(id) })}+ let left = ClosureMenuItem(L("Take down everything to the left")) { line.takeDown(id, toTheLeft: true) }+ left.isEnabled = !line.neighbours(of: id, toTheLeft: true).isEmpty+ menu.addItem(left)+ let right = ClosureMenuItem(L("Take down everything to the right")) { line.takeDown(id, toTheLeft: false) }+ right.isEnabled = !line.neighbours(of: id, toTheLeft: false).isEmpty+ menu.addItem(right)return menu}}diff --git a/Sources/Tendedero/Line.swift b/Sources/Tendedero/Line.swiftindex 7b75fe7..6f69aee 100644--- a/Sources/Tendedero/Line.swift+++ b/Sources/Tendedero/Line.swift@@ -118,7 +118,25 @@ final class Line: ObservableObject {/// "Take everything down": every photo goes the way of its corner cross.func clear() {+ takeDown(items.filter { !$0.falling })+ }++ /// 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)...])+ }++ /// Takes down everything on one side of a photo. Each one goes the way+ /// of its own corner button: to the Trash from Tendedero's folder, and+ /// only off the line from anywhere else.+ func takeDown(_ id: UUID, toTheLeft: Bool) {+ takeDown(neighbours(of: id, toTheLeft: toTheLeft))+ }++ /// One after another, and only the first makes a sound.+ private func takeDown(_ live: [Pegged]) {for (n, item) in live.enumerated() {DispatchQueue.main.asyncAfter(deadline: .now() + 0.06 * Double(n)) { [weak self] inself?.discard(item.id, quietly: n > 0)diff --git a/Sources/Tendedero/Resources/az.lproj/Localizable.strings b/Sources/Tendedero/Resources/az.lproj/Localizable.stringsindex e1dfd22..b0a8259 100644--- a/Sources/Tendedero/Resources/az.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/az.lproj/Localizable.strings@@ -56,6 +56,8 @@"Discard" = "At";"Take down" = "İpdən götür";"Move to Trash" = "Zibil qutusuna at";+"Take down everything to the left" = "Soldakıların hamısını götür";+"Take down everything to the right" = "Sağdakıların hamısını götür";/* LineView */"Take a screenshot and it will hang here" = "Ekran şəkli çəkin, burada asılacaq";diff --git a/Sources/Tendedero/Resources/en.lproj/Localizable.strings b/Sources/Tendedero/Resources/en.lproj/Localizable.stringsindex 03b346f..c6933b0 100644--- a/Sources/Tendedero/Resources/en.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/en.lproj/Localizable.strings@@ -56,6 +56,8 @@"Discard" = "Discard";"Take down" = "Take down";"Move to Trash" = "Move to Trash";+"Take down everything to the left" = "Take down everything to the left";+"Take down everything to the right" = "Take down everything to the right";/* LineView */"Take a screenshot and it will hang here" = "Take a screenshot and it will hang here";diff --git a/Sources/Tendedero/Resources/es.lproj/Localizable.strings b/Sources/Tendedero/Resources/es.lproj/Localizable.stringsindex d218dcf..a6420d7 100644--- a/Sources/Tendedero/Resources/es.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/es.lproj/Localizable.strings@@ -54,6 +54,8 @@"Discard" = "Descartar";"Take down" = "Descolgar";"Move to Trash" = "Mover a la Papelera";+"Take down everything to the left" = "Descolgar todo lo de la izquierda";+"Take down everything to the right" = "Descolgar todo lo de la derecha";/* LineView */"Take a screenshot and it will hang here" = "Haz una captura y se quedará colgada aquí";diff --git a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings b/Sources/Tendedero/Resources/tr.lproj/Localizable.stringsindex 81f7e47..8b85c25 100644--- a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/tr.lproj/Localizable.strings@@ -54,6 +54,8 @@"Discard" = "Sil";"Take down" = "İndir";"Move to Trash" = "Çöp Kutusu'na taşı";+"Take down everything to the left" = "Soldakilerin hepsini indir";+"Take down everything to the right" = "Sağdakilerin hepsini indir";/* LineView */"Take a screenshot and it will hang here" = "Bir ekran görüntüsü al, buraya asılacak";diff --git a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.stringsindex 913f708..9ca0daf 100644--- a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings+++ b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings@@ -54,6 +54,8 @@"Discard" = "丢弃";"Take down" = "取下";"Move to Trash" = "移到废纸篓";+"Take down everything to the left" = "取下左侧全部";+"Take down everything to the right" = "取下右侧全部";/* LineView */"Take a screenshot and it will hang here" = "截个图,它就会挂在这里";