Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BetterShot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
3F10E4A10ECE3E37549B99BA /* EditorWindowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FC4CD374D6C387202BB773 /* EditorWindowView.swift */; };
6158A6FD21D793D955B2E0E9 /* AppPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = C757566A38307689528E5A9E /* AppPreferences.swift */; };
615EE1453C9A7BDFD9248E09 /* ScreenCapture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4495302A23BB2192D91C5ED3 /* ScreenCapture.swift */; };
B10CC4E1D0C4B5E2F3A45001 /* ScrollingCapture.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10CC4E1D0C4B5E2F3A45002 /* ScrollingCapture.swift */; };
6682480DF2FDA028736D23D2 /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9822447B9DE8F15B9CC94381 /* PreferencesView.swift */; };
7492DCC25BAEBAFD914AAC6C /* EditorCanvasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D72A7FD249FD623240D8735 /* EditorCanvasView.swift */; };
7A3EBC41CA7A6F9DE045888B /* AnnotationRedactionImageProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 147306FB804DB8E1D8FC83DA /* AnnotationRedactionImageProcessor.swift */; };
Expand Down Expand Up @@ -60,6 +61,7 @@
1A8FF0E5AD713FC1D7E99DE7 /* BetterShotDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetterShotDelegate.swift; sourceTree = "<group>"; };
3E1907B91A013BCA494AB08A /* ColorPickerOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerOverlay.swift; sourceTree = "<group>"; };
4495302A23BB2192D91C5ED3 /* ScreenCapture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenCapture.swift; sourceTree = "<group>"; };
B10CC4E1D0C4B5E2F3A45002 /* ScrollingCapture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollingCapture.swift; sourceTree = "<group>"; };
4B626577BDFABF32D144DC8B /* CaptureOrchestrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaptureOrchestrator.swift; sourceTree = "<group>"; };
5229BD9DF667A270F2BF5A01 /* EditorInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorInspectorView.swift; sourceTree = "<group>"; };
5BADFC6B5CCEDC123DF696D8 /* AppUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdater.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -157,6 +159,7 @@
7DB9ADF51148B7B593827415 /* CountdownOverlay.swift */,
868F0E1B6C8FC7DF50B4A79B /* RegionSelectionOverlay.swift */,
4495302A23BB2192D91C5ED3 /* ScreenCapture.swift */,
B10CC4E1D0C4B5E2F3A45002 /* ScrollingCapture.swift */,

);
path = Capture;
Expand Down Expand Up @@ -355,6 +358,7 @@
A548A41489DDA1DF28A3C44A /* PreviewOverlay.swift in Sources */,
3933094B835D8EF2F5F1EABB /* RegionSelectionOverlay.swift in Sources */,
615EE1453C9A7BDFD9248E09 /* ScreenCapture.swift in Sources */,
B10CC4E1D0C4B5E2F3A45001 /* ScrollingCapture.swift in Sources */,
8782829F9AD2E1BE2B796AC7 /* ShortcutService.swift in Sources */,

A1B2C3D4E5F6A7B8C9D0E1F2 /* ScreenRecordingManager.swift in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to Better Shot will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- **Scrolling capture (long screenshot)**: CleanShot X–style scrolling capture — select a region, scroll manually or use auto-scroll, and frames are stitched vertically by pixel matching into one tall screenshot. Floating HUD with live height, auto-scroll toggle, Done/Cancel, region border overlay, and Esc to cancel. Available from the new "Scrolling" button in the menu bar; the result runs through the standard pipeline (history, beautifier, preview)

## [0.3.7] - 2026-06-07

### Added
Expand Down
20 changes: 20 additions & 0 deletions Sources/Capture/CaptureOrchestrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ final class CaptureOrchestrator {
}
}

/// Finishes a capture produced outside the normal flow (e.g. scrolling capture):
/// runs the same history + beautifier + preview pipeline as a regular screenshot.
func finishExternalCapture(cgImage: CGImage, on screen: NSScreen?) async {
captureScreen = screen
let tempPath = NSTemporaryDirectory() + "bettershot_scroll_\(Int(Date().timeIntervalSince1970 * 1000)).png"
let tempURL = URL(fileURLWithPath: tempPath)
guard let dest = CGImageDestinationCreateWithURL(tempURL as CFURL, "public.png" as CFString, 1, nil) else { return }
CGImageDestinationAddImage(dest, cgImage, nil)
guard CGImageDestinationFinalize(dest) else { return }
ScreenCapture.shared.playShutterSound()
let record = HistoryStore.shared.importCapture(from: tempURL)
if let record {
lastCaptureURL = HistoryStore.shared.urlForRecord(record)
}
if let capturedURL = lastCaptureURL {
await galleryApplyAndSave(capturedURL, recordID: record?.id)
}
captureScreen = nil
}
Comment on lines +53 to +69

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple footguns here: early returns can leave captureScreen set, and if importCapture fails you can end up running galleryApplyAndSave on the previous lastCaptureURL.

Suggested change
func finishExternalCapture(cgImage: CGImage, on screen: NSScreen?) async {
captureScreen = screen
let tempPath = NSTemporaryDirectory() + "bettershot_scroll_\(Int(Date().timeIntervalSince1970 * 1000)).png"
let tempURL = URL(fileURLWithPath: tempPath)
guard let dest = CGImageDestinationCreateWithURL(tempURL as CFURL, "public.png" as CFString, 1, nil) else { return }
CGImageDestinationAddImage(dest, cgImage, nil)
guard CGImageDestinationFinalize(dest) else { return }
ScreenCapture.shared.playShutterSound()
let record = HistoryStore.shared.importCapture(from: tempURL)
if let record {
lastCaptureURL = HistoryStore.shared.urlForRecord(record)
}
if let capturedURL = lastCaptureURL {
await galleryApplyAndSave(capturedURL, recordID: record?.id)
}
captureScreen = nil
}
func finishExternalCapture(cgImage: CGImage, on screen: NSScreen?) async {
captureScreen = screen
defer { captureScreen = nil }
let tempPath = NSTemporaryDirectory() + "bettershot_scroll_\(Int(Date().timeIntervalSince1970 * 1000)).png"
let tempURL = URL(fileURLWithPath: tempPath)
guard let dest = CGImageDestinationCreateWithURL(tempURL as CFURL, "public.png" as CFString, 1, nil) else { return }
CGImageDestinationAddImage(dest, cgImage, nil)
guard CGImageDestinationFinalize(dest) else { return }
ScreenCapture.shared.playShutterSound()
guard let record = HistoryStore.shared.importCapture(from: tempURL) else { return }
try? FileManager.default.removeItem(at: tempURL)
let capturedURL = HistoryStore.shared.urlForRecord(record)
lastCaptureURL = capturedURL
await galleryApplyAndSave(capturedURL, recordID: record.id)
}


// MARK: - Private

private func captureAndProcess(_ capture: () async throws -> URL?) async {
Expand Down
Loading