This article explains how to use a script on a Linux machine that was originally written to work on Mac OS. You can download the code from https://github.com/dreamhost/screencaps.
Setting up your Linux environment
The code is written in Python and requires the boto library to connect to DreamObjects. You can install boto by opening the Terminal and typing:
[local]$ pip install boto
You may see the following error when running the 'pip' command:
-bash: pip: command not found
This means you do not have pip installed on your system. You can type this in the Terminal instead to install it on Ubuntu (it will require an admin password):
[local]$ sudo apt-get install python-boto
You will also need a program to take the screenshot. I use 'scrot'. To install scrot on Ubuntu run the command below.
[local]$ sudo apt-get install scrot
- Create a folder called 'bin' in your home directory.
- Copy the dhdo-screencap.py file into it.
- Open dhdo-screencap.py with a text editor
- Paste in your DreamObjects Access Key, Secret Key and bucket name (ensure each of these are surrounded by single quotes).
If you are running the script on Linux you will need to change some things in the dhdo-screencap.py file, such as set the program that will take the screenshot
result = subprocess.call(['screencapture', '-i', f.name])
result = subprocess.call(['scrot', f.name])
The above code is equivalent to running the following command in a shell.
[local]$ scrot filename.png
Save and close it. Now you can run the script and it will take a screenshot and upload it to the bucket you specified. It is a good idea to assign this to a keyboard shortcut. How you do this depends on what desktop environment or window manager you use.