Getting Screenshots working the way I prefer in LXDE

Written by James McDonald

February 24, 2011

The default command on lubuntu-desktop for ALT-PrintScreen and PrintScreen dump the file in $HOME

On my Fedora 20 LXDE install there are no preconfigured screen shot options. So the following needs to be added to the openbox config xml.

Before you start install scrot

# ubuntu / debian
sudo apt-get install scrot 

# fedora / redhat
yum install scrot

I prefer the screenshot to land in my Pictures folder. I also prefer to take a snapshot of the current window with ALT+PrintScreen as opposed to having to select a region (scrot -s).

The Ubuntu version of scrot has a -u option to take the currently active window. The Fedora 20 version doesn’t have -u so you need to have -s in the command and then click the window you want to screen shot.

To make the change I edited ~/.config/openbox/lubuntu-rc.xml (~/ means your home directory) or ~/.config/openbox/lxde-rc.xml in my Fedora 20 install.

And changed the keybinding section as follows:

Ubuntu ~/.config/openbox/lubuntu-rc.xml 

<keyboard>
    <!-- Keybindings for Screenshots -->
	<!-- print screen key press take full screenshot -->
	<keybind key="Print">
	<action name="Execute">
	<command>scrot -e 'mv $f ~/Pictures/'</command>
	</action>
	</keybind>
	<!-- alt + print screen button take window -->
	<keybind key="A-Print">
	<action name="Execute">
	<command>scrot -b -u -e 'mv $f ~/Pictures/'</command>
	</action>
	</keybind>
<!-- rest of key bind config continues from here -->
</keyboard>

Fedora 20 ~/.config/openbox/lxde-rc.xml

<keyboard>
    <!-- Keybindings for Screenshots -->
	<!-- print screen key press take full screenshot -->
	<keybind key="Print">
	<action name="Execute">
	<command>scrot -e 'mv $f ~/Pictures/'</command>
	</action>
	</keybind>
	<!-- alt + print screen button take window -->
	<keybind key="A-Print">
	<action name="Execute">
	<command>scrot -b -s -e 'mv $f ~/Pictures/'</command>
	</action>
	</keybind>
<!-- rest of key bind config continues from here -->
</keyboard>

Old code was scrot and scrot -s
scrot
scrot -s

Version: Ubuntu 10.10 current as at 2011-02-24

1 Comment

  1. Michael Kory Wood

    Thanks for the awesome post!

    I’m running LXDE on Arch and use ImageMagick to grab full-screenshots (per LXDE’s wiki) and your scrot method to grab single-window screenshots. There’s two things that might help for posterity, though, as follows:

    Scrot (at least version 0.8, which looks like it’s been out for some time) doesn’t have the -u option (maybe it’s something added downstream from scrot in Ubuntu development?). To overcome this, I use -s and (manually) select the window in which I’m interested.

    Also, in the XML file, remember to close the with a below the line.

    Thanks again!

    Reply

Submit a Comment

Your email address will not be published.

You May Also Like…

ZPL SBPL

Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...