Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created June 28, 2016 17:35
Show Gist options
  • Save d0ugal/a18c5e98898dfdb4be893d924661010c to your computer and use it in GitHub Desktop.
Save d0ugal/a18c5e98898dfdb4be893d924661010c to your computer and use it in GitHub Desktop.
#!/bin/bash
SCREEN_DIR=~/Dropbox/Public/Screenshots
SCREEN_PROMPT=1
window='root'
case $1 in
root)
window='root';;
active)
window=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d' ' -f5`;;
esac
if [ -z "$name" ];then
if [ $window == "root" ];then
name=''
else
name=`xprop -id $window | sed -n '/WM_CLASS/s/.* = "\([^\"]*\)".*/\1\n/p'`
[ -z "$name" ] && name='window'
name=".$name"
fi
fi
filename="Screenshot `date +%Y-%m-%d-%H.%M.%S`$name.png"
import -border -window $window "$SCREEN_DIR/$filename"
dropbox puburl "$SCREEN_DIR/$filename" | xclip -sel clip
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment