Page 1 of 1

scrot-x

Posted: Sun 24 Apr 2011, 17:10
by alexandrion
basically this is a script that uses scrot to create screenshots
the default scrot save names are very long so this script changes the screenshot names to xxxx.png

Image

first create the "images" folder in the root folder
place this script in /usr/bin/scrot-x, don't forget to chmod +x it
scrot-x

Code: Select all

#! /bin/bash
number=`sed -n "17 p" "$0"`
keep=$number
delay=0$1
if [ $delay -lt 1 ];
then
delay=0
fi
len=${#number}
while [ $len -lt 4 ];
do
number=0$number
len=$(($len+1))
done
scrot $number'.png' -d $delay -e 'mv $f ~/images/ & viewnior ~/images/$f' | sed -i "17s/$keep/$(($keep + 1))/" /usr/bin/scrot-x
exit
1
to bind it to your print screenshot key first check which key matches your Print screenshot button

type this in a terminal

Code: Select all

xev | gawk '/keycode/{if($0!=l)printf "0x%x\n",$4;l=$0;}'
and press Print Screen to see what you get

mine was 0x6f

so now i can add the key bindings to my rc.xml

Print screen for instant screenshot or alt+print screen for screenshot in 5 seconds (you can change to how many seconds you want)
in my case, it was

Code: Select all

    <keybind key="0x6f">
      <action name="Execute">
        <execute>scrot-x</execute>
      </action>
    </keybind>
    <keybind key="A-0x6f">
      <action name="Execute">
        <execute>scrot-x 5</execute>
      </action>
    </keybind>
after you added the new keybindings type in a terminal

Code: Select all

openbox -- reconfigure
and the print screen button should work creating fast screenshots without any messy interface

questions / feedback highly appreciated

Posted: Tue 24 May 2011, 16:24
by sc0ttman
Nice, I like this, simple enough to do what I want and no more... Thanks!

Posted: Wed 25 May 2011, 03:55
by alexandrion
i'm glad you like it :)