Take Screenshots on Arch Linux with Scrot

#arch linux #scrot #screenshot #cli #productivity

Why use GUI tools when the terminal can do it faster?

sudo pacman -S scrot  # Installation
mkdir ~/Pictures/
scrot ~/Pictures/screenshot_%Y-%m-%d_$wx$h.png

Basic Usage Cheat Sheet

CommandAction
scrotFull screen → YYYY-MM-DD-HHMMSS.png
scrot -sInteractive region selection
scrot -d 55-second delay
scrot -uCurrent focused window
scrot ~/Pictures/%Y-%m-%d_$wx$h.pngCustom filename pattern

Advanced Capture Techniques

Thumbnail Generation

scrot -t 50  # 50% size thumbnail

Post-Processing Pipeline

Screenshot Post-Processing

# Quick install for image tools
sudo pacman -S imagemagick

Watermark

scrot -e \
'mogrify -pointsize 24 -fill "rgba(255,255,255,0.5)" \
-draw "text 20,30 Watermark" \
-gravity southeast $f'
  • pointsize 24: Text size
  • fill rgba(255,255,255,0.5): Semi-transparent white
  • draw text: Draw text at position
  • gravity southeast: Text position

OCR Capture: From Screenshot to Clipboard

scrot -s /tmp/ocr-area.png && \
tesseract /tmp/ocr-area.png - | xclip -selection clipboard

Components:

  1. tesseract: OCR engine extracting text from images.
    • Install with:
    sudo pacman -S tesseract tesseract-data-eng  # English language data
  2. xclip: Clipboard management tool
    • Installation requirement:
    sudo pacman -S xclip

Window Manager Integration

Qtile Keybindings

# ~/.config/qtile/config.py
Key([], "Print", lazy.spawn("scrot -e 'mv $f ~/Pictures/'")),

System-Wide Shortcuts

# Using sxhkd (~/.config/sxhkd/sxhkdrc)
Print
    scrot -e 'mv $f ~/Pictures/'