scrot-x

Miscellaneous tools
Post Reply
Message
Author
User avatar
alexandrion
Posts: 105
Joined: Sat 19 Feb 2011, 06:45

scrot-x

#1 Post 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
Attachments
scrot_0.8-13_i386.pet
(16.64 KiB) Downloaded 525 times
giblib1_1.2.4-5_i386.pet
(17.98 KiB) Downloaded 536 times

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#2 Post by sc0ttman »

Nice, I like this, simple enough to do what I want and no more... Thanks!
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
alexandrion
Posts: 105
Joined: Sat 19 Feb 2011, 06:45

#3 Post by alexandrion »

i'm glad you like it :)

Post Reply