Created
November 12, 2014 01:46
-
-
Save emmaly/e28617c4481fb5fc0155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bind this to a hotkey in your window manager. This will allow you to select | |
# a rectangle on your screen to store as a PNG file and then puts the path to | |
# that PNG file into your clipboard. It assumes you want to store the file in | |
# ~/Pictures/Screenshots, but you can change that yourself in the FILENAME var. | |
# Requires: | |
# - imagemagick (provides /usr/bin/import) | |
# - xclip (provides /usr/bin/xclip) | |
if [ ! -x /usr/bin/xclip -o ! -x /usr/bin/import ]; then | |
echo "ABORTED. Requires both xclip and imagemagick." >&2 | |
echo "The following command will be useful." >&2 | |
echo "apt-get install xclip imagemagick" >&2 | |
exit 1 | |
fi | |
FILENAME="$HOME/Pictures/Screenshots/Screenshot-$(date +%Y%m%d-%H%M%S).png" | |
mkdir -p "$(dirname $(readlink -m $FILENAME))" | |
/usr/bin/import "$FILENAME" | |
echo -n "$FILENAME" | /usr/bin/xclip -selection c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment