Archives

All posts for the month February, 2013

As part of my work with Wayne and Layne, Adam and I do a lot of work together remotely, since I live in Pennsylvania and he lives in Minnesota. It’s really nice to be able to quickly share a work in progress, whether it be a diagram in Inkscape or a printed circuit board layout in Kicad. Setting up a Skype or other screen sharing system incurs too much transaction cost and isn’t very quick, so I was looking for something quicker and simpler.

I wrote this little script to take a screenshot of my entire display, add a timestamp to the bottom, and automatically upload it to my website. I set up an SSH key between my computer and my webserver (that is unlocked when I login), and added the following script to my path as screenshot_poster.sh

#!/bin/bash
#
# This script will capture the whole screen
# and upload it to the web in a known location
# Written by Matthew Beckler for Wayne and Layne, LLC
# Last updated August 31, 2012

cd /tmp
import -window root temp.png
WIDTH=`identify -format %w temp.png`
DATE=`date`
convert -background '#0008' -fill white -gravity west -size ${WIDTH}x30 caption:"$DATE" temp.png +swap -gravity south -composite screenshot.png
scp screenshot.png user@example.com:/var/www/rest/of/the/path/to/screenshot.png

DEST="http://example.com/path/to/screenshot.png"
# do you want a notification or to just open the browser?
#notify-send -t 1000 "Screenshot posted" "$DEST"
xdg-open "$DEST"

The final two lines allow you to make a little desktop notification of the URL, open a web browser to the image’s location, or both. Someday I will set up a nice keyboard shortcut to run this script, to make the process of sharing my work-in-progress as quick and easy as possible.

screenshot

I really enjoy the new feature in recent versions of Ubuntu, where I can drag a window to the top, left, or right edge of a display to resize the window to take up the full area, the left half, or the right half, respectively, of the display. For my 27″ external display, however, I thought it would be nice to make the display corners into drop target that would resize the window to occupy just a corner of the display. Turns out that this functionality is already built-in to the Compiz plugin called “Grid”. You just have to tweak a few settings to enable it.

compizconfit_settings_manager_grid

To access the right settings, you must first install the CompizConfig Settings Manager, so go to the Ubuntu software center and search for that package. Once you’ve installed it, search for the same name from the launcher to start it up. Heed well the warning about seriously messing up your desktop. Click on “Window Management” from the category list on the left side, and then select “Grid”. Select the “Edges” tab, and expand “Resize Actions”. Change the drop-down options for the four corner items to match the corner, as shown in the screenshot above. Now, you can drag a window to the corner of a display to have it resize to fill that quarter of the screen, as shown below.

corner_window_resize

It doesn’t work 100% perfectly with multiple displays, having some troubles and inconsistent behavior with the “shared corners” but it works more than well enough for my needs.