Add screenshot thingy
This commit is contained in:
parent
b8eb80d232
commit
d0dd41c080
35
session/src/xmd-screenshot
Executable file
35
session/src/xmd-screenshot
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! type scrot > /dev/null; then
|
||||||
|
>&2 echo "!!! scrot is not installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
picturesDir=`xdg-user-dir PICTURES`
|
||||||
|
test -z "$picturesDir" && picturesDir="$HOME/Pictures"
|
||||||
|
picturesDir="$picturesDir/Screen Shots"
|
||||||
|
|
||||||
|
if ! mkdir -p "$picturesDir"; then
|
||||||
|
>&2 echo "!!! can't create $picturesDir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
output="$picturesDir/`date -Iseconds`.png"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"selection")
|
||||||
|
scrot --select --line style=dash --freeze --file "$output"
|
||||||
|
clipArg="$2"
|
||||||
|
;;
|
||||||
|
"window")
|
||||||
|
scrot --focused --border --file "$output"
|
||||||
|
clipArg="$2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
scrot --file "$output"
|
||||||
|
clipArg="$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test "$clipArg" = "clipboard"; then
|
||||||
|
xclip -selection clipboard -target image/png -i "$output"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user