Skip to content

Screenshots, hung out to dry. A tiny native macOS app that hangs every screenshot on a line at the top of your screen.

Swift

Space and Delete over a photo

Alejandro Buján27f7c03ba83c
diff --git a/README.md b/README.md
index 3e124e2..1f707fb 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,8 @@ 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>&thinsp;<kbd>Z</kbd> with the pointer on the line | Hang back what you just let go. |
+| <kbd>Space</kbd> with the pointer on a photo | Take a quick look. |
+| <kbd>⌫</kbd> with the pointer on a photo | Let it go, as its corner button does. |
| 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. |
diff --git a/Sources/Tendedero/AppDelegate.swift b/Sources/Tendedero/AppDelegate.swift
index a0a4be3..2b8ad5f 100644
--- a/Sources/Tendedero/AppDelegate.swift
+++ b/Sources/Tendedero/AppDelegate.swift
@@ -491,6 +491,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
mouseTimer = nil
panel.ignoresMouseEvents = true
holdPutBackKey(false)
+ holdPhotoKeys(over: nil)
}
/// How long the cursor rests against the top edge before the line comes
@@ -550,6 +551,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
guard isRevealed else {
holdPutBackKey(false)
+ holdPhotoKeys(over: nil)
line.closeGaps()
// Resting in the middle of the menu bar brings the line down on
// that screen. Pushing against the top edge is part of it, and it
@@ -585,6 +587,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
let inside = NSMouseInRect(mouse, zone, false)
if inside && pinned { pinned = false }
holdPutBackKey(inside)
+ holdPhotoKeys(over: inside ? photo(under: mouse) : nil)
// Gaps left by discarded photos close once the pointer moves away.
if !inside { line.closeGaps() }
@@ -655,6 +658,47 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
if !any { NSSound.beep() }
}
+ // MARK: Keys over a photo
+
+ /// Delete and Space while the pointer rests on a photo: Delete does what
+ /// its corner button does, Space takes a quick look, as in Finder. Like
+ /// ⌘Z, they are borrowed as hot keys only then, so every other app keeps
+ /// them.
+ private var photoKeys: [HotKey] = []
+ private var photoKeysFor: UUID?
+
+ private func holdPhotoKeys(over id: UUID?) {
+ let id = id.flatMap { id in line.items.first { $0.id == id && !$0.falling && !$0.held }?.id }
+ guard id != photoKeysFor else { return }
+ photoKeysFor = id
+ photoKeys = []
+ guard let id else { return }
+ photoKeys = [
+ HotKey(Shortcut(keyCode: kVK_Delete, modifiers: [], key: "\u{8}")) { [weak self] in
+ self?.line.pressCorner(id)
+ },
+ HotKey(Shortcut(keyCode: kVK_Space, modifiers: [], key: " ")) { [weak self] in
+ self?.quickLookToggle(id)
+ },
+ ].compactMap { $0 }
+ }
+
+ /// The photo whose card is under the pointer, if any.
+ private func photo(under mouse: NSPoint) -> UUID? {
+ let local = panel.convertPoint(fromScreen: mouse)
+ let flipped = CGPoint(x: local.x, y: panel.frame.height - local.y)
+ return line.hitRects.first { $0.value.contains(flipped) }?.key
+ }
+
+ /// Space opens Quick Look, and closes it again if it is already open.
+ private func quickLookToggle(_ id: UUID) {
+ if QLPreviewPanel.sharedPreviewPanelExists(), let panel = QLPreviewPanel.shared(), panel.isVisible {
+ panel.orderOut(nil)
+ } else {
+ line.quickLook(id)
+ }
+ }
+
// MARK: Putting back
/// ⌘Z while the pointer is on the line. The line never takes the
@@ -971,3 +1015,4 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}
}
+
diff --git a/Sources/Tendedero/QuickLook.swift b/Sources/Tendedero/QuickLook.swift
index f776a5f..3019cf6 100644
--- a/Sources/Tendedero/QuickLook.swift
+++ b/Sources/Tendedero/QuickLook.swift
@@ -2,12 +2,13 @@ import AppKit
import Quartz
/// A quick look at a photo without opening it: the same Quick Look window
-/// Finder shows. Force click a photo, or choose Quick Look from its menu.
-/// The arrow keys go through the rest of the line, and Space or Escape
-/// closes it.
+/// Finder shows. Space with the pointer on a photo, a force click, or Quick
+/// Look from its menu. The arrow keys go through the rest of the line, and
+/// Space or Escape closes it.
///
-/// The line never takes the keyboard from the app you are in, so Space over
-/// a photo cannot open it; the window takes the keyboard once it is open.
+/// The line never takes the keyboard from the app you are in: Space is only
+/// borrowed while the pointer rests on a photo, and the window takes the
+/// keyboard once it is open.
@MainActor
final class QuickLook: NSObject, QLPreviewPanelDataSource, QLPreviewPanelDelegate {
static let shared = QuickLook()
diff --git a/docs/i18n/README.az.md b/docs/i18n/README.az.md
index 9919136..8fed73c 100644
--- a/docs/i18n/README.az.md
+++ b/docs/i18n/README.az.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd> | Atdığınızı ipə geri asır. |
+| Göstərici şəklin üstündəykən <kbd>Boşluq</kbd> | Tez baxın. |
+| Göstərici şəklin üstündəykən <kbd>⌫</kbd> | Küncdəki düyməsi kimi buraxın. |
| 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. |
diff --git a/docs/i18n/README.es.md b/docs/i18n/README.es.md
index d45724c..9d73a72 100644
--- a/docs/i18n/README.es.md
+++ b/docs/i18n/README.es.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd> con el puntero en la cuerda | Vuelve a colgar lo que acabas de soltar. |
+| <kbd>Espacio</kbd> con el puntero en una foto | Échale un vistazo. |
+| <kbd>⌫</kbd> con el puntero en una foto | Suéltala, como su botón de la esquina. |
| 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. |
diff --git a/docs/i18n/README.fr.md b/docs/i18n/README.fr.md
index c2543e8..adbead9 100644
--- a/docs/i18n/README.fr.md
+++ b/docs/i18n/README.fr.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd>, le pointeur sur la corde | Raccroche ce que vous venez de laisser filer. |
+| <kbd>Espace</kbd>, le pointeur sur une photo | Jetez-y un coup d’œil. |
+| <kbd>⌫</kbd>, le pointeur sur une photo | Laissez-la filer, comme son bouton d’angle. |
| 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. |
diff --git a/docs/i18n/README.gl.md b/docs/i18n/README.gl.md
index d08c81a..e31a41b 100644
--- a/docs/i18n/README.gl.md
+++ b/docs/i18n/README.gl.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd> co punteiro na corda | Volve colgar o que acabas de soltar. |
+| <kbd>Espazo</kbd> co punteiro nunha foto | Bótalle unha ollada. |
+| <kbd>⌫</kbd> co punteiro nunha foto | Sóltaa, como o seu botón da esquina. |
| 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. |
diff --git a/docs/i18n/README.hi.md b/docs/i18n/README.hi.md
index d62a154..30344c4 100644
--- a/docs/i18n/README.hi.md
+++ b/docs/i18n/README.hi.md
@@ -57,6 +57,8 @@
| किसी फ़ोल्डर में खींचें | उसे वहीं रखें। वह रस्सी से उतर जाती है। |
| ट्रैश में खींचें, या क्रॉस पर क्लिक करें | जाने दें। |
| पॉइंटर रस्सी पर रखकर <kbd>⌘</kbd>&thinsp;<kbd>Z</kbd> | जिसे अभी जाने दिया, उसे वापस टाँगें। |
+| पॉइंटर फ़ोटो पर रखकर <kbd>Space</kbd> | झट से देखें। |
+| पॉइंटर फ़ोटो पर रखकर <kbd>⌫</kbd> | कोने के बटन की तरह जाने दें। |
| राइट क्लिक, फिर पिन करें | इसे रखें: यह गाँठ के बाईं ओर स्पेस ग्रे क्लिप पर टँगा रहता है, और कोई नया स्क्रीनशॉट इसे नहीं हटाता। |
| राइट क्लिक, फिर हाथ में लें | इसे रस्सी से उतारें और काम करते समय सामने रखें। |
| Finder में किसी तस्वीर पर राइट क्लिक, फिर Tendedero पर टाँगें | कोई भी तस्वीर रस्सी पर पिन करके टाँगें। |
diff --git a/docs/i18n/README.ja.md b/docs/i18n/README.ja.md
index 2022b66..f44e7fd 100644
--- a/docs/i18n/README.ja.md
+++ b/docs/i18n/README.ja.md
@@ -57,6 +57,8 @@
| フォルダにドラッグ | そこに保存。ロープからは外れます。 |
| ゴミ箱にドラッグ、または×をクリック | 手放す。 |
| ポインタをロープに置いて <kbd>⌘</kbd>&thinsp;<kbd>Z</kbd> | 手放したばかりのものを掛け直す。 |
+| ポインタを写真に置いて <kbd>Space</kbd> | クイックルックで見る。 |
+| ポインタを写真に置いて <kbd>⌫</kbd> | 角のボタンと同じように手放す。 |
| 右クリックして「ピン留め」 | 残しておく。結び目の左にスペースグレイのクリップで吊るされ、新しいスクリーンショットに押し出されない。 |
| 右クリックして「手に取る」 | ロープから外して、作業中も目の前に置いておく。 |
| Finderで画像を右クリックして「Tendederoに吊るす」 | どんな画像もピン留めしてロープに吊るす。 |
diff --git a/docs/i18n/README.ko.md b/docs/i18n/README.ko.md
index 546d198..ac83a24 100644
--- a/docs/i18n/README.ko.md
+++ b/docs/i18n/README.ko.md
@@ -57,6 +57,8 @@
| 폴더로 드래그 | 폴더에 보관해요. 빨랫줄에서는 사라져요. |
| 휴지통으로 드래그하거나 X 버튼 클릭 | 미련 없이 버려요. |
| 포인터를 빨랫줄에 두고 <kbd>⌘</kbd>&thinsp;<kbd>Z</kbd> | 방금 버린 걸 다시 걸어요. |
+| 포인터를 사진에 두고 <kbd>Space</kbd> | 훑어봐요. |
+| 포인터를 사진에 두고 <kbd>⌫</kbd> | 모서리 버튼처럼 놓아줘요. |
| 오른쪽 클릭 후 고정하기 | 남겨 둬요. 매듭 왼쪽에 스페이스 그레이 집게로 걸리고, 새 스크린샷에 밀려나지 않아요. |
| 오른쪽 클릭 후 손에 들기 | 줄에서 내려 작업하는 동안 눈앞에 둬요. |
| Finder에서 이미지를 오른쪽 클릭 후 Tendedero에 걸기 | 어떤 이미지든 고정해서 줄에 걸어요. |
diff --git a/docs/i18n/README.pt-BR.md b/docs/i18n/README.pt-BR.md
index 77f270e..df0e121 100644
--- a/docs/i18n/README.pt-BR.md
+++ b/docs/i18n/README.pt-BR.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd> com o ponteiro no varal | Pendura de volta o que você acabou de soltar. |
+| <kbd>Espaço</kbd> com o ponteiro numa foto | Dê uma olhada rápida. |
+| <kbd>⌫</kbd> com o ponteiro numa foto | Solte-a, como o botão do canto dela. |
| 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. |
diff --git a/docs/i18n/README.tr.md b/docs/i18n/README.tr.md
index a72fa19..d5d0039 100644
--- a/docs/i18n/README.tr.md
+++ b/docs/i18n/README.tr.md
@@ -57,6 +57,8 @@ 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>&thinsp;<kbd>Z</kbd> | Az önce bıraktığını geri asar. |
+| İşaretçi bir fotoğrafın üzerindeyken <kbd>Boşluk</kbd> | Hızlıca bak. |
+| İşaretçi bir fotoğrafın üzerindeyken <kbd>⌫</kbd> | Köşedeki düğmesi gibi bırak. |
| 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. |
diff --git a/docs/i18n/README.zh-Hans.md b/docs/i18n/README.zh-Hans.md
index c76728d..91142cd 100644
--- a/docs/i18n/README.zh-Hans.md
+++ b/docs/i18n/README.zh-Hans.md
@@ -57,6 +57,8 @@
| 拖进文件夹 | 存在那儿。原图从绳上取下。 |
| 拖到废纸篓,或点叉 | 松手丢弃。 |
| 指针在绳子上时按 <kbd>⌘</kbd>&thinsp;<kbd>Z</kbd> | 把刚丢掉的挂回去。 |
+| 指针在照片上时按 <kbd>空格</kbd> | 快速查看。 |
+| 指针在照片上时按 <kbd>⌫</kbd> | 像点角上的按钮一样放开它。 |
| 右键点按,选“固定” | 留住它:它挂在绳结左边,用深空灰夹子夹着,新截图不会把它挤掉。 |
| 右键点按,选“拿在手上” | 从绳上取下,工作时一直放在眼前。 |
| 在“访达”中右键点按图片,选“挂到 Tendedero” | 把任何图片固定挂到绳上。 |