How to take a screenshot in LXDE using scrot and the Print Screen button on the keyboard

lxdeopenboxraspberry piscreenshot

How can I take a screenshot in LXDE using scrot and the Print Screen button on my keyboard? The Windows Manager appears to be Openbox.

Best Answer

Edit ~/.config/openbox/lxde-rc.xml with your favorite text editor and then, within the existing <keyboard> element, add the following lines:

<keybind key="Print">
  <action name="Execute">
    <command>scrot</command>
  </action>
</keybind>

Use the openbox --reconfigure command to use the new settings.

Following the restart, a screenshot will be created in your /home/pi directory every time you press the Print Screen button.

There's also a GUI tool called obkey which can make editing the Openbox config file easier. You can find it here.

Related Question