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

A photo put back stays on the screen the line is on

Alejandro Bujánc986c351142c
diff --git a/Sources/Tendedero/AppDelegate.swift b/Sources/Tendedero/AppDelegate.swift
index 2b8ad5f..db9128c 100644
--- a/Sources/Tendedero/AppDelegate.swift
+++ b/Sources/Tendedero/AppDelegate.swift
@@ -294,6 +294,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
/// A new screenshot lifts off from where it was taken and flies to its
/// place on the line. Without a known capture area it simply drops in.
private func hangCapture(_ url: URL) {
+ // Already hanging: a photo put back with ⌘Z comes out of the Trash
+ // into the folder, and the watcher sees it arrive. It must not pull
+ // the line over to the screen it was first taken on.
+ guard !line.items.contains(where: { $0.url.standardizedFileURL == url.standardizedFileURL && !$0.falling })
+ else { return }
let from = captureRect(of: url)
let screen = from.flatMap { from in
NSScreen.screens.first { NSMouseInRect(CGPoint(x: from.midX, y: from.midY), $0.frame, false) }