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

Menu bar icon shows when the line is empty (#71)

Anubhav-Rai7356f76565b5
diff --git a/Sources/Tendedero/AppDelegate.swift b/Sources/Tendedero/AppDelegate.swift
index 8e02e50..37faafc 100644
--- a/Sources/Tendedero/AppDelegate.swift
+++ b/Sources/Tendedero/AppDelegate.swift
@@ -260,6 +260,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
/// An empty line goes away, unless it was opened on purpose.
private func itemsChanged() {
+ updateStatusIcon()
guard line.liveCount == 0, !keepOpen else { return }
DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { [weak self] in
guard let self, self.line.liveCount == 0, !self.keepOpen else { return }
@@ -626,14 +627,20 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
}
/// The shirt fills in while copied images are hung, so it shows at a
- /// glance that the clipboard is being watched.
+ /// glance that the clipboard is being watched. It is dimmed while the
+ /// line is empty, so resting in the menu bar and seeing nothing come down
+ /// does not look broken.
private func updateStatusIcon() {
let on = ClipboardWatcher.isEnabled
+ let count = line.liveCount
let description = on ? L("Tendedero, hanging copied images") : "Tendedero"
- let image = NSImage(systemSymbolName: on ? "tshirt.fill" : "tshirt", accessibilityDescription: description)
+ let state = count == 0 ? L("The line is empty") : String(format: L("%d on the line"), count)
+ let image = NSImage(systemSymbolName: on ? "tshirt.fill" : "tshirt",
+ accessibilityDescription: "\(description), \(state)")
image?.isTemplate = true
statusItem.button?.image = image
- statusItem.button?.toolTip = description
+ statusItem.button?.appearsDisabled = count == 0
+ statusItem.button?.toolTip = "\(description)\n\(state)"
}
func menuNeedsUpdate(_ menu: NSMenu) {
diff --git a/Sources/Tendedero/Resources/az.lproj/Localizable.strings b/Sources/Tendedero/Resources/az.lproj/Localizable.strings
index b0a8259..5386a2f 100644
--- a/Sources/Tendedero/Resources/az.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/az.lproj/Localizable.strings
@@ -45,6 +45,8 @@
"Hang copied images" = "Kopyalanmış şəkilləri as";
"Images you copy hang on the line too" = "Kopyaladığınız şəkillər də ipdən asılır";
"Tendedero, hanging copied images" = "Tendedero, kopyalanmış şəkilləri asır";
+"The line is empty" = "İp boşdur";
+"%d on the line" = "İpdə %d ədəd";
/* GrabArea */
"Copy" = "Kopyala";
diff --git a/Sources/Tendedero/Resources/en.lproj/Localizable.strings b/Sources/Tendedero/Resources/en.lproj/Localizable.strings
index c6933b0..002cec8 100644
--- a/Sources/Tendedero/Resources/en.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/en.lproj/Localizable.strings
@@ -45,6 +45,8 @@
"Hang copied images" = "Hang copied images";
"Images you copy hang on the line too" = "Images you copy hang on the line too";
"Tendedero, hanging copied images" = "Tendedero, hanging copied images";
+"The line is empty" = "The line is empty";
+"%d on the line" = "%d on the line";
/* GrabArea */
"Copy" = "Copy";
diff --git a/Sources/Tendedero/Resources/es.lproj/Localizable.strings b/Sources/Tendedero/Resources/es.lproj/Localizable.strings
index a6420d7..c9b149a 100644
--- a/Sources/Tendedero/Resources/es.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/es.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "Colgar imágenes copiadas";
"Images you copy hang on the line too" = "Las imágenes que copias también se cuelgan";
"Tendedero, hanging copied images" = "Tendedero, colgando imágenes copiadas";
+"The line is empty" = "La cuerda está vacía";
+"%d on the line" = "%d en la cuerda";
/* GrabArea */
"Copy" = "Copiar";
diff --git a/Sources/Tendedero/Resources/fr.lproj/Localizable.strings b/Sources/Tendedero/Resources/fr.lproj/Localizable.strings
index 6eb98b3..b669abf 100644
--- a/Sources/Tendedero/Resources/fr.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/fr.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "Accrocher les images copiées";
"Images you copy hang on the line too" = "Les images copiées s’accrochent aussi à la corde";
"Tendedero, hanging copied images" = "Tendedero, accroche les images copiées";
+"The line is empty" = "La corde est vide";
+"%d on the line" = "%d sur la corde";
/* GrabArea */
"Copy" = "Copier";
diff --git a/Sources/Tendedero/Resources/gl.lproj/Localizable.strings b/Sources/Tendedero/Resources/gl.lproj/Localizable.strings
index 31ce6cb..ea83610 100644
--- a/Sources/Tendedero/Resources/gl.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/gl.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "Pendurar imaxes copiadas";
"Images you copy hang on the line too" = "As imaxes que copias tamén se penduran";
"Tendedero, hanging copied images" = "Tendedero, pendurando imaxes copiadas";
+"The line is empty" = "A corda está baleira";
+"%d on the line" = "%d na corda";
/* GrabArea */
"Copy" = "Copiar";
diff --git a/Sources/Tendedero/Resources/hi.lproj/Localizable.strings b/Sources/Tendedero/Resources/hi.lproj/Localizable.strings
index f24e006..edcecb0 100644
--- a/Sources/Tendedero/Resources/hi.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/hi.lproj/Localizable.strings
@@ -45,6 +45,8 @@
"Hang copied images" = "कॉपी की गई तस्वीरें टाँगें";
"Images you copy hang on the line too" = "आप जो तस्वीरें कॉपी करते हैं, वे भी रस्सी पर टँगती हैं";
"Tendedero, hanging copied images" = "Tendedero, कॉपी की गई तस्वीरें टाँग रहा है";
+"The line is empty" = "रस्सी खाली है";
+"%d on the line" = "रस्सी पर %d";
/* GrabArea */
"Copy" = "कॉपी करें";
diff --git a/Sources/Tendedero/Resources/ja.lproj/Localizable.strings b/Sources/Tendedero/Resources/ja.lproj/Localizable.strings
index 8352d0d..63ee27c 100644
--- a/Sources/Tendedero/Resources/ja.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/ja.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "コピーした画像を吊るす";
"Images you copy hang on the line too" = "コピーした画像もロープに吊るされます";
"Tendedero, hanging copied images" = "Tendedero、コピーした画像を吊るしています";
+"The line is empty" = "ロープは空です";
+"%d on the line" = "ロープに%d件";
/* GrabArea */
"Copy" = "コピー";
diff --git a/Sources/Tendedero/Resources/ko.lproj/Localizable.strings b/Sources/Tendedero/Resources/ko.lproj/Localizable.strings
index 35a7659..9399f70 100644
--- a/Sources/Tendedero/Resources/ko.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/ko.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "복사한 이미지 걸기";
"Images you copy hang on the line too" = "복사한 이미지도 빨랫줄에 걸려요";
"Tendedero, hanging copied images" = "Tendedero, 복사한 이미지 거는 중";
+"The line is empty" = "빨랫줄이 비어 있어요";
+"%d on the line" = "빨랫줄에 %d개";
/* GrabArea */
"Copy" = "복사하기";
diff --git a/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings b/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings
index cbb7979..df6b942 100644
--- a/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/pt-BR.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "Pendurar imagens copiadas";
"Images you copy hang on the line too" = "As imagens que você copia também vão para o varal";
"Tendedero, hanging copied images" = "Tendedero, pendurando imagens copiadas";
+"The line is empty" = "O varal está vazio";
+"%d on the line" = "%d no varal";
/* GrabArea */
"Copy" = "Copiar";
diff --git a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings b/Sources/Tendedero/Resources/tr.lproj/Localizable.strings
index 8b85c25..3b64d0c 100644
--- a/Sources/Tendedero/Resources/tr.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/tr.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "Kopyalanan görselleri as";
"Images you copy hang on the line too" = "Kopyaladığınız görseller de ipe asılır";
"Tendedero, hanging copied images" = "Tendedero, kopyalanan görselleri asıyor";
+"The line is empty" = "İp boş";
+"%d on the line" = "İpte %d tane";
/* GrabArea */
"Copy" = "Kopyala";
diff --git a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings
index 9ca0daf..4f36609 100644
--- a/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings
+++ b/Sources/Tendedero/Resources/zh-Hans.lproj/Localizable.strings
@@ -43,6 +43,8 @@
"Hang copied images" = "挂上复制的图片";
"Images you copy hang on the line too" = "复制的图片也会挂上绳";
"Tendedero, hanging copied images" = "Tendedero,正在挂上复制的图片";
+"The line is empty" = "晾衣绳上是空的";
+"%d on the line" = "晾衣绳上有 %d 张";
/* GrabArea */
"Copy" = "复制";