How to take screenshots
- Install scrot with your package manager. On Debian and Ubuntu-like systems, type sudo apt-get install scrot. If your account isn't included in the sudoers file, first type su, type your password and afterwards type apt-get install scrot. On RPM-based systems who are using yum, type sudo yum install scrot. Same here about the sudoers file.
- Run scrot (type scrot in your terminal)
- Press the PrtScr-button. The screenshot will be in /home/user/.
imagemagick is a collection of tools and libraries for many image formats. It is pre-installed in most distributions. You can check the availability of the binary needed by typing
$ which import /usr/bin/import
Step 1: create shell script for making screenshots
First of all you will need to create a file with name screenshot.sh for example in /usr/local/bin/ directory. It should contain next lines:
#!/bin/bash DATE=`date +%Y-%m-%d\ %H:%M:%S` import -window root "$HOME/Desktop/screenshot $DATE.png"
What does this script do? First line of the script code assigns current date in format YYYY-mm-dd hh:mm:ss to DATE variable. Next line grabs the root window and writes a file named screenshot 'YYYY-mm-dd hh:mm:ss.png' to your ~/Desktop/ directory
Step 2: make script executable
$ sudo chmod a+x /usr/local/bin/screenshot.sh
That's all. Go next step.
Step 3: Make openbox run this script on pressing PrintScreen key
Edit file ~/.config/openbox/lxde-rc.xml and make sure to append there the following in the <keyboard> section:
<keybind key="Print"> <action name="Execute"> <command>screenshot.sh</command> </action> </keybind>
Now either relogin to load the new configuration or type:
$ openbox --reconfigure
New png files will appear right on our desktop.