Skip to content

Instantly share code, notes, and snippets.

@Mrfiregem
Created April 9, 2022 06:14
Show Gist options
  • Save Mrfiregem/cd858402dd14b89ea0390fbef2f1a376 to your computer and use it in GitHub Desktop.
Save Mrfiregem/cd858402dd14b89ea0390fbef2f1a376 to your computer and use it in GitHub Desktop.
A simple screenshot utility for Wayland WMs
#!/bin/sh
: "${IRIVER_DIR:=$(xdg-user-dir PICTURES)/iriver}"
if [ -z "$1" ]; then
[ -d "${IRIVER_DIR}" ] || mkdir -p "${IRIVER_DIR}"
outfile="${IRIVER_DIR}/$(date '+%FT%T%z').png"
else
_base=$(dirname "$1")
if [ -d "$_base" ]; then
outfile=$1
else
printf '%s: error: Directory "%s" does not exist\n' "$0" "$_base" 1>&2
exit 1
fi
fi
grim -g "$(slurp)" "$outfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment