Skip to content

Instantly share code, notes, and snippets.

@phagenlocher
Last active February 18, 2025 16:39
Show Gist options
  • Select an option

  • Save phagenlocher/5981894250bf48ea44db79895cb94f6b to your computer and use it in GitHub Desktop.

Select an option

Save phagenlocher/5981894250bf48ea44db79895cb94f6b to your computer and use it in GitHub Desktop.
Scrot but saves files in a temporary directory and automatically copies the screenshot to the clipboard
#!/bin/bash
DIR="/tmp/screenshots"
mkdir -p "$DIR"
TIMESTAMP=$(date +%Y-%m-%dT%H-%M-%S)
FILE=$(mktemp -u -p "$DIR" -t "$TIMESTAMP-XXXXX.png")
scrot -e 'xclip -selection clipboard -t image/png -i $f' "$@" "$FILE" && echo "$FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment