Screenshots from the Openbox menu

There lots of little ways to take a screenshot from the Openbox right-click menu. Mine all involve scrot, which is a fabulous little command-line-driven snapshot utility from the maker of feh. Like most command-line programs, it’s immensely flexible and lightning-fast, regardless of the machine you use.

The first suggestion for taking a screenshot from the command line is only a mixed blessing. There’s a mini-GUI program called gscreenshot that will do all the interactions with scrot for you, giving you options for snapping the whole screen or selecting one window or one area, and so forth.

It’s useful and it works well; the problem is that it’s pretty much unmaintained, and has no installation instructions aside from the PKGBUILD on its AUR page. The standing PKGBUILD will fail too, since it doesn’t have an arch=() line and the installation steps use brackets, which are a no-no.

Regardless, if you insert your architecture and you change the first line of the build sequence to

mkdir -p $startdir/pkg/usr/bin $startdir/pkg/usr/share/gscreenshot

it will install perfectly and work fine. Ubuntu users can follow the steps and commands shown in the PKGBUILD, and it should (I won’t say “will”) install properly.

And to be honest, in spite of the messy installation, I like it — it gives you all the functions of scrot without having to reference all the --help options, does only one thing, needs almost no dependencies, and so forth. You get to preview your image, save in different formats, etc.

So aside from the gnarled installation routine, it’s actually quite a nice little program.

Of course, if you’re willing to go without a GUI and you just want a one-liner for your right-click menu, insert this into your menu.xml file somewhere, or with ObMenu.

scrot -q 100 -d 1 screenshot-%F-%H%M%S.jpg

That’s what I use for my screenshots; it snaps a full-quality, full-screen image in JPG format, with the date and time imprinted in the file name. That command will drop it into your home directory, and from there you can upload it, resize, crop or what have you. If you have a special location where you like to put screenshots, prefix the filename with the path you want.

(The one-second delay with the -d flag is just because Openbox takes a split second to un-draw its frames, and otherwise the ghosts appear in the screenshot. ;) )

Remember that with a one-line command like that, you can automate the process of snapping, uploading and so forth. You could even set up a cron job that takes a picture of your desktop at regular intervals and then uploads it to a web page. Ooh!

See, isn’t the command line amazing? :D

8 Responses to “Screenshots from the Openbox menu”


  1. 1 tamihania 2008/02/07 at 6:57 PM

    Just wanted to say thank you for another nice tip. I’m one of your “subscribers” – and I’ve learned from you a lot. Currently, I’m using PekWM on Arch – your tip works without a glitch here, too.
    Thanks once again – and – have a nice day!
    Kind regards,
    tami

  2. 2 freduardo 2008/02/07 at 8:28 PM

    Nice !

    I usually use
    import -window root screen.jpg
    which is part of imagemagick I think.

    But this works (at least) as well.

    I’ve added it to my openbox menu.

    Thanks for the tip!

    Freduardo

  3. 3 Moparx 2008/02/08 at 12:14 PM

    I personally prefer to assign scrot the the Print Screen key via rc.xml.

    scrot %Y-%m-%d_moparx.png -t 576×230 -d 2

  4. 4 Moparx 2008/02/08 at 12:16 PM

    It stripped the code.. hehe.
    Basically you just make an keybind entry for “Print” and tell it to execute the command.

  5. 5 K.Mandla 2008/02/08 at 12:20 PM

    :D Sorry about that. WordPress.com does that to me on an almost-daily basis. I’m sure most OB users know what you meant though. Thanks!

  6. 6 Penguin 2009/07/09 at 1:54 AM

    Thank you for very nice tips. I would like to have scrot under my lxde with openbox under print screen key.
    Thanks to Moparx suggestion I added under keyboard section of rc.xml like this:

    “scrot -d 1 screenshot-%F-%H%M%S.jpg”

    Unfortunately this does not work. Could someone tell me please what I do wrong,or paste an example from his rc.xml.

  7. 7 Penguin 2009/07/09 at 2:37 AM

    I write once again my code it was unreadable in browser. Sorry.
    <!– keybinding for screenshot –>
       <keybind key=”Print”>
         <action name=”Execute”>

         <command>”scrot -d 1 screenshot-%F-%H%M%S.jpg”</command>
         </action>
       </keybind>

  8. 8 Penguin 2009/07/11 at 9:06 PM

    After many tests I have written a correct configure script by myself. Here is my ~/.config/openbox/lxde-rc.xml. Maybe someone will need it like me :) . It works with Debian LXDE, so it should work with Ubuntu LXDE or lite. Penguin sends greetings from Poland.
    <!– keybinding for screenshot –>
       <keybind key=”Print”>
         <action name=”Execute”>
         <execute>scrot -d 1 screenshot-%F-%H%M%S.jpg</execute>
         </action>
       </keybind>


Leave a Reply




Welcome!

Some recent desktops


Sept. 24, 2009
screen-vs on Crux Linux
550Mhz Celeron 192Mb PC100


Aug. 21, 2009
Crux 2.4 with Xorg 7.3
and Musca 0.9.23
120Mhz Pentium 16Mb PC66 40Gb

Be counted!

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Downloads

Blog Stats

  • 1,402,153 hits

Categories

Archives

Calendar

February 2008
S M T W T F S
« Jan   Mar »
 12
3456789
10111213141516
17181920212223
242526272829