Skip to content

Instantly share code, notes, and snippets.

@Dobbie03
Created January 13, 2018 21:12
Show Gist options
  • Select an option

  • Save Dobbie03/5fbb7152c74dcb57d83a7c925a6698b0 to your computer and use it in GitHub Desktop.

Select an option

Save Dobbie03/5fbb7152c74dcb57d83a7c925a6698b0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# Take a screenshot and display a notification.
#
# Created by Dylan Araps.
#
# Depends on: imagemagick, libnotify (patched with id support)
# Screenshot directory
scr_dir="${HOME}/Screenshots/ArchLabs"
mkdir -p "$scr_dir" || { printf "%s\n" "Error: Couldn't create screenshot directory"; exit; }
# Use printf to store the current date/time as variables.
printf -v date "%(%F)T"
printf -v time "%(%I-%M-%S)T"
# Create current date format.
mkdir -p "${scr_dir}/${date}"
# Name the screenshot
scr="${scr_dir}/${date}/${date}-${time}.png"
notify-send " Saved screenshot as ${scr/*\/}"
scrot "$scr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment