Skip to content

sshot - Simple Screenshot Tool

Lightweight screenshot capture utility with basic editing and sharing capabilities.

Overview

sshot provides quick and simple screenshot capture with optional basic editing features. It focuses on speed and simplicity, making it ideal for quick captures and documentation screenshots.

When to use: When you need fast screenshot capture without complex features or editing.

Usage

sshot [options] [output-file]
```bash

### Options

- `-s`: Select area (interactive)
- `-w`: Capture active window
- `-f`: Capture full screen
- `-d DELAY`: Delay before capture (seconds)
- `-o FILE`: Output file (default: auto-generated)
- `-c`: Copy to clipboard
- `-u`: Upload to service
- `-e`: Edit after capture
- `-q QUALITY`: Image quality (1-100)
- `-h`: Show help

## Examples

### Basic Capture

```bash
# Capture full screen
sshot

# Capture active window
sshot -w

# Select area interactively
sshot -s
```bash

### Advanced Usage

```bash
# Capture with delay
sshot -d 3 -s

# Save to specific file
sshot -o screenshot.png -f

# Copy to clipboard
sshot -c -w

# Edit after capture
sshot -e -s
```bash

### Batch Capture

```bash
# Multiple screenshots
for i in {1..5}; do
    sshot -o "capture-$i.png" -d 1
    sleep 2
done

# Timed captures
sshot -d 10 -o before.png
# Do something...
sshot -o after.png
```bash

## How It Works

### Capture Methods

1. **Full Screen**: Complete desktop capture
2. **Window**: Active/focused window capture
3. **Selection**: Interactive area selection
4. **Clipboard**: Direct clipboard integration

### Output Options

- **File**: Save to specified path
- **Clipboard**: Copy image data
- **Upload**: Send to image hosting service
- **Edit**: Open in image editor

## Configuration

Zshand’s `sshot` is configured only via environment variables (no config file). Set these in `$ZSHAND_CONFIG_DIR/env.zsh` (e.g. `~/.config/zshand/env.zsh`). See `samples/user-config/env.zsh` and `samples/user-config/ENVIRONMENT_VARIABLES.md`.

### Environment variable

| Variable                 | Default                              | Description                    |
| ------------------------ | ------------------------------------ | ------------------------------ |
| `ZSHAND_SCREENSHOTS_DIR` | `$ZSHAND_CACHE_DIR/screenshots`       | Directory where screenshots are saved |

Example:

```bash
# Use a custom directory (e.g. Pictures)
export ZSHAND_SCREENSHOTS_DIR="$HOME/Pictures/Screenshots"

If unset, the script uses $ZSHAND_CACHE_DIR/screenshots, then $XDG_CACHE_HOME/zshand/screenshots, then $HOME/.cache/zshand/screenshots.

Dependencies

The script auto-detects environment (macOS, Linux Wayland, Linux X11, WSL) and picks the first available tool.

Screenshot tools (by priority per environment)

  • macOS: screencapture (region/window)
  • Wayland: spectacle (KDE), gnome-screenshot, flameshot, grim+slurp
  • X11: spectacle, gnome-screenshot, flameshot, scrot, maim, xfce4-screenshooter, import (ImageMagick)

Clipboard

  • macOS: pbcopy
  • Wayland: wl-copy
  • X11: xclip or xsel

Optional

  • notify-send (Linux): optional notification after capture
  • xdotool (X11): for window capture when using some tools

Troubleshooting

No Screenshot Taken

Symptom: Command runs but no file created

Cause: Screenshot tool not available

Fix:

# Check available tools
which scrot maim screencapture

# Install screenshot tool
sudo apt install scrot slop  # Ubuntu
sudo dnf install maim slop   # Fedora
brew install imagemagick     # macOS
```bash

### Selection Not Working

**Symptom:** `-s` option doesn't show selection

**Cause:** Selection tool missing

**Fix:**

```bash
# Install slop (for maim)
sudo apt install slop

# Alternative: use scrot with selection
scrot -s screenshot.png
```bash

### Clipboard Not Working

**Symptom:** `-c` doesn't copy to clipboard

**Cause:** Clipboard tool not available

**Fix:**

```bash
# Install clipboard tool
sudo apt install xclip     # X11
sudo apt install wl-clipboard  # Wayland

# Check clipboard
echo "test" | xclip -selection clipboard
xclip -selection clipboard -o
```bash

### Upload Fails

**Symptom:** `-u` option fails

**Cause:** Upload service configuration

**Fix:**

```bash
# Configure upload service
# Edit ~/.config/sshot/config.toml
[upload]
service = "imgur"
api_key = "your-api-key-here"

# Test upload manually
curl -X POST -F "image=@screenshot.png" https://api.imgur.com/3/upload
```bash

## Performance

### Capture Times

| Method      | Time     | File Size (1920x1080) |
| ----------- | -------- | --------------------- |
| Full screen | 0.1-0.5s | 200-800KB             |
| Window      | 0.1-0.3s | 50-300KB              |
| Selection   | 0.2-1.0s | 20-200KB              |

### Resource Usage

- **Memory**: 10-30MB
- **CPU**: Minimal (<5%)
- **Disk**: Output file size only

## Integration

### With Window Manager

```bash
# i3wm keybinding
bindsym $mod+Print exec sshot -w
bindsym Print exec sshot -s
bindsym $mod+Shift+Print exec sshot -f
```bash

### With Notification System

```bash
# Notify after capture
sshot -o /tmp/screenshot.png && notify-send "Screenshot taken" "/tmp/screenshot.png"
```bash

### With File Manager

```bash
# Open screenshot directory (uses ZSHAND_SCREENSHOTS_DIR when set)
sshot && xdg-open "${ZSHAND_SCREENSHOTS_DIR:-$HOME/.cache/zshand/screenshots}"
```bash

### With Documentation Workflow

```bash
# Capture for documentation
sshot -s -o "docs/images/feature-$(date +%s).png"
```bash

## Technical Details

### Capture Backends

#### scrot (Linux)

```bash
# Full screen
scrot screenshot.png

# With delay
scrot -d 3 screenshot.png

# Select area
scrot -s screenshot.png
```bash

#### maim (Linux)

```bash
# Full screen
maim screenshot.png

# Select area
maim -s screenshot.png

# Active window
maim -i $(xdotool getactivewindow) screenshot.png
```bash

#### screencapture (macOS)

```bash
# Full screen
screencapture screenshot.png

# Interactive selection
screencapture -i screenshot.png
```bash

### Image Formats

- **PNG**: Lossless, best quality (default)
- **JPG**: Lossy, smaller files
- **Quality**: 1-100 (higher = better quality/larger file)

### Clipboard Integration

```bash
# X11 clipboard
xclip -selection clipboard -t image/png screenshot.png

# Wayland clipboard
wl-copy < screenshot.png
```bash

### Upload Services

- **imgur**: Anonymous image hosting
- **imgbb**: Free image hosting
- **Custom**: Configurable endpoints
- **API Integration**: RESTful upload APIs

## See Also

- **[archshots](archshots.md)** - Advanced architecture screenshots
- **[syssnap](syssnap.md)** - System snapshot tool
- **[Screenshot Tools](../../README.md#screenshots)** - Screenshot guide