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? πŸ˜€

Advertisements

10 thoughts on “Screenshots from the Openbox menu

  1. tamihania

    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

    Reply
  2. freduardo

    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

    Reply
  3. K.Mandla Post author

    πŸ˜€ 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!

    Reply
  4. Penguin

    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.

    Reply
  5. Penguin

    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>

    Reply
  6. Penguin

    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>

    Reply
  7. Edgar

    Thanks a lot, i switched from XFCE to LXDE (OpenBox window manager) and it was usefull to screen capture….

    also, in order to get the changes i un the command:

    #openbox –reconfigure

    and it’s all, i got my screenshot pressing PrintScreen key

    thanks a lot again πŸ™‚

    Reply
    1. Edgar

      sorry the command is:
      #openbox –reconfigure

      with double “lines”, i don’t remember the name in english (i’m spanish speaker πŸ˜› )

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s