Created
August 21, 2015 21:58
-
-
Save Enzime/8b372b58834abbe93b7e to your computer and use it in GitHub Desktop.
Small script that uses maim and xclip (and xwininfo and xdotool) to take screenshots and upload them to pomf clones (with limf)
This file contains 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 | |
file=~/Pictures/Screenshots/$(date +%y-%m-%d_%H-%M-%S).png | |
if [[ "$1" == "desktop" ]]; then | |
maim $file | |
elif [[ "$1" == "current" ]]; then | |
# maim -i $(xdotool getactivewindow) $file | |
maim -i $(xwininfo -id $(xwininfo -id $(xdotool getactivewindow) -children | grep "Parent window id" | sed -r "s/.*: (0x[0-9a-f]+) .*/\1/") | sed -r "s/.*: (0x[0-9a-f]+) .*/\1/" | head -n2 | tail -n1) -g $(xwininfo -id $(xwininfo -id $(xdotool getactivewindow) -children | grep "Parent window id" | sed -r "s/.*: (0x[0-9a-f]+) .*/\1/") | tail -n3 | head -n2 | py -l 'list(map(str.split,l))[1][1].replace("-","+").split("+")[0]+list(map(str.split,l))[0][1]') $file | |
else | |
maim -s $file | |
fi | |
if [ -f $file ]; then | |
url=$(limf -l -c 0 $file) | |
echo $url | xclip -selection clipboard | |
firefox $url | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment