Last active
November 9, 2018 14:00
-
-
Save ihabunek/7c0bebf96074bf447829b39e13dab05c 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
#!/usr/bin/env bash | |
# Find an unused file name to capture to | |
DIR=~/Pictures/Screenshots/ | |
N=1 | |
while [ -f "$DIR`printf %05d $N`.png" ]; do | |
N=$((N+1)) | |
done | |
FILENAME=$DIR`printf %05d $N`.png | |
# Take screenshot, if successful copy to clipboard and show notification | |
if maim -s > $FILENAME; then | |
xclip -selection clip -target image/png < $FILENAME | |
notify-send "Screenshot saved" $FILENAME | |
fi |
@afarazit Actually that does not work since it takes a literal ~
instead of expanding it. However if you remove the quotes then it works. I'll change the gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 4 should be
"DIR=~/Pictures/Screenshots/"
so that everyone can take your script and use it without the need to modify the home path