Skip to content

ItsSVK/snappr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Snappr

A lightweight, native macOS screenshot utility written in Rust that provides fast, minimal-UI screenshot capture with global hotkeys.

Features

  • Fullscreen Screenshot (Alt+Shift+A) - Capture the entire screen
  • Area Selection Screenshot (Alt+Shift+S) - Select and capture a specific area
  • Background Operation - Runs silently with menu bar icon only
  • Automatic Save - Screenshots saved to ~/Documents/Screenshots/Snappr/
  • Clipboard Integration - Screenshots automatically copied to the clipboard
  • Retina Display Support - High-resolution capture on Retina displays
  • Fast Performance - Native Rust implementation with minimal overhead

Requirements

  • macOS 10.13 (High Sierra) or later
  • Screen Recording permission (granted on first run)

Installation

From Source

  1. Install Rust (if not already installed):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Clone and build:

    git clone <repository-url>
    cd snappr
    ./scripts/build_app_bundle.sh
  3. Install to Applications:

    cp -r target/release/Snappr.app /Applications/
  4. Launch:

    open /Applications/Snappr.app

Usage

Taking Screenshots

  • Fullscreen: Press Alt+Shift+A

    • Captures the entire screen
    • Saves to ~/Documents/Screenshots/Snappr/Screenshot-YYYYMMDD-HHMMSS.png
    • Copies the screenshot to the clipboard
  • Area Selection: Press Alt+Shift+S

    • Displays transparent overlay
    • Click and drag to select area
    • Release to capture
    • Saves to ~/Documents/Screenshots/Snappr/Screenshot-YYYYMMDD-HHMMSS.png
    • Copies the screenshot to the clipboard

Menu Bar

Click the πŸ“Έ icon in the menu bar to:

  • View app version
  • Quit the application

Permissions

On first run, Snappr will request Screen Recording permission:

  1. A message will appear in the terminal
  2. System Settings will open automatically
  3. Navigate to: Privacy & Security > Screen Recording
  4. Enable Snappr
  5. Restart the app

Auto-Launch at Login

To automatically start Snappr when you log in:

./scripts/generate_launch_agent.sh
launchctl load ~/Library/LaunchAgents/com.snappr.agent.plist

To disable auto-launch:

launchctl unload ~/Library/LaunchAgents/com.snappr.agent.plist

Development

Project Structure

snappr/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs              # Application entry point
β”‚   β”œβ”€β”€ app_delegate.rs      # AppDelegate and menu bar
β”‚   β”œβ”€β”€ hotkeys.rs           # Global hotkey registration
β”‚   β”œβ”€β”€ screenshot.rs        # Screenshot capture logic
β”‚   β”œβ”€β”€ clipboard.rs         # Clipboard integration
β”‚   β”œβ”€β”€ storage.rs           # File saving
β”‚   β”œβ”€β”€ permissions.rs       # Permission handling
β”‚   β”œβ”€β”€ utils.rs             # Utility functions
β”‚   └── overlay/
β”‚       β”œβ”€β”€ mod.rs           # Overlay module
β”‚       β”œβ”€β”€ window.rs        # Transparent overlay window
β”‚       └── selection_view.rs # Selection rectangle view
β”œβ”€β”€ resources/
β”‚   └── Info.plist           # App bundle configuration
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ build_app_bundle.sh  # Build .app bundle
β”‚   └── generate_launch_agent.sh # Auto-launch setup
└── Cargo.toml

Building

# Check for errors
cargo check

# Build debug version
cargo build

# Build release version
cargo build --release

# Create .app bundle
./scripts/build_app_bundle.sh

Running in Development

cargo run

Technical Details

Technologies

  • Language: Rust (2021 edition)
  • macOS APIs: AppKit, CoreGraphics, Carbon (via FFI)
  • Key Crates:
    • cocoa - Rust bindings for Cocoa
    • objc - Objective-C runtime
    • core-graphics - CoreGraphics bindings
    • image - PNG encoding

Architecture

  • NSApplication with Accessory activation policy (no dock icon)
  • Carbon HotKey API for global hotkey registration
  • CGDisplay for screen capture
  • NSPasteboard for clipboard operations
  • Custom NSView subclass for selection overlay

Performance

  • Screenshot capture: < 50ms
  • Memory usage: < 50MB
  • Binary size: < 10MB
  • Startup time: < 5ms

Troubleshooting

Screenshots not working

  1. Check Screen Recording permission in System Settings
  2. Restart the app after granting permission

Hotkeys not responding

  1. Ensure no other app is using the same hotkeys
  2. Check Console.app for error messages
  3. Try restarting the app

App not appearing in menu bar

  1. Check if the app is running: ps aux | grep snappr
  2. Kill and restart: killall snappr && open /Applications/Snappr.app

License

[Add your license here]

Credits

Built with Rust and native macOS frameworks for maximum performance and minimal resource usage.

About

πŸ“Έ Snappr β€” a tiny native macOS screenshot tool in Rust: global hotkeys for fullscreen/area grabs, auto-save, clipboard copy, and handy notifications. ⚑️ Fast, minimal, and menu-bar friendly

Resources

Stars

Watchers

Forks

Contributors