Automatically Pop Up Steam Key

Now that I’ve got steam, I get to be constantly pestered by e-mails sending me keys with which to identify that I am myself. To save a few steps in this annoying, repetitive process I wrote a tiny bash script which finds the key in an e-mail from steam and uses zenity to pop it up on my screen, then added a filter in Evolution Mail to mark these “steam verification” messages as read and pipe them to the pop-up script. This allows me to copy the key with a double-click and paste it into steam with a middle-click, without having to poke around in my mail client for the e-mail and the place where the key is mentioned in it.

In the hope that it saves someone else from this irksomeness, here’s the code for the script:

/sinisterstuf/5795214
#/bin/bash
 
# Displays a pop-up showing a Steam activation key piped to it by a MUA.
# In the e-mail the steam key is wrapped in <h2> tags
# Author: Siôn Le Roux <sinisterstuf@gmail.com>
 
# read e-mail from pipe
while read -r line; do
    # find <h2>
    buffer=$(echo $line | grep 'h2')
    if [[ ! -z $buffer ]]; then
        #strip surrounding <h2> tags
        steamkey=$(echo $buffer | sed -e 's/<\/\?h2>//g')
    fi
done
 
# display the steam code in a pop-up
zenity --info --title="Steam Key" \
    --window-icon="/usr/share/pixmaps/steam.png" \
    --text="<tt><big><b>$steamkey</b></big></tt>"

CSS for TODO Elements

I wrote a small CSS class .todo for cases when you want to mark HTML elements on a page that you still want to work on later. Add this class to elements that aren’t ready yet, to mark them so that you won’t forget about them and ship the site unfinished. See the Gist’s description on GitHub for more information on how to use it. Here’s the code:

/sinisterstuf/4682224
/* CSS for adding TODO notes on WIP pages */
div.todo { /* style the text in a bright box */
  color: red;
  font-size: large;
	background-color: yellow;
	text-align: center;
	border: 3px solid red;
	border-bottom: 1px solid red;
	margin-bottom: 0;
	padding: 1px;
}
div.todo:before { /* prepend the word TODO to the text */
	font-weight: bold;
	content: "↓ TODO: "
}
div.todo+* { /* style the following element in a bright box too */
	border: 3px solid red;
	border-top: 0;
	margin-top: 0;
}