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. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...