Switch Colours in the GIMP

GIMP Colour SwitcherAfter my previous discovery I thought surely there should also be an easy keyboard shortcut for swapping the foreground and background colours in the GIMP, even though it doesn’t seem to be documented anywhere. There is. Just press X.

Actually I think it would be useful if this was shown in the tooltip text when you hover over the colour switching button, like it does with the other tools. If you’re curious, here is a list of 74 keyboard shortcuts for the GIMP (including this one) that you might not have known otherwise. I think keyboard shortcuts are great for editing pictures because you can change tools (and now also swap colours) without moving your cursor away from where you’re drawing!

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>"

Packaged Tomboy add-ins for Arch Linux

The wiki-like note taking application, Tomboy, maintains a list of user-written add-ins on its website, almost none of which were available in the Arch Linux repositories. Recently I learnt how packages are created for Arch Linux and read up on the standards, so I ‘adopted’ an ownerless add-in package from the Arch Linux User Repository and packaged 6 more.

Finally, I created a meta-package called tomboy-extras which contains nothing but depends on all the working Tomboy add-ins (tested on my laptop) in the AUR, to easily install all add-ins at once. I created a gist on GitHub for each package’s build script and made a repository containing the meta-package’s PKGBUILD file and each gist as a git sub-module named after the package name. The README file in tomboy-extras’ git repository contains links to the gists for the add-ins’ PKGBUILDs so that they can be found easily.

So, if you would like to contribute to one of them, feel free to fork the relevant gist, or leave a comment there, and if you would like to contribute to tomboy-extras itself or have an add-in included, just fork tomboy-extras and send a pull request; I’ll probably be adding more add-ins to it myself already. Also, if you do use any of these packages, please give them a vote on AUR so that we can see how many people use them. If they’re popular, they may be included in the official repositories, who knows!

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;
}

Running Sparkup Vim Plug-in on Arch Linux

The sparkup plugin for vim lets you write HTML markup faster by Zen Coding, in which you write short code, resembling CSS selectors, which is then expanded to HTML by the editor. For example, writing

div#nav>ul#menu>li.item*3

would give you:

<div id="nav">
    <ul id="menu">
        <li class="item"></li>
        <li class="item"></li>
        <li class="item"></li>
    </ul>
</div>

This is obviously extremely useful, as it saves a lot of typing. However, I encountered a bit of trouble using this plugin on my laptop, which runs on Arch Linux. It’s easily solved though. Continue reading

Steam available in Arch Linux repositories

This news is at least a few days old by now, but it seems the official Steam client for GNU/Linux is now out of Beta and ready for use! Ubuntu users could already download the deb package from the steam website. However, if you’re an Arch Linux user, like me, then you’ll find that since the 26th of February, the steam client is already in the official Arch repositories and can be installed with a simple:

# pacman -S steam

Of course as soon as it’s installed it’s time for Steam to start its slow, perpetual update process, but except for that I think this is fantastic!

Free Software Day tomorrow

If Pockey Lam hadn’t pointed it out I probably wouldn’t have known it was Software Freedom tomorrow. Better than last year though, when I only found out after it had happened. Software Freedom is important to me —most of this blog is related to it— and I’d really like Namibia to participate in this event, especially the Polytechnic of Namibia where I study, as it’s one of the few universities on the African continent mirroring Free Software.

In this effort I’ve written a post on the PoNLUG site and sent some emails in an attempt to get people excited about organising something for an event this weekend or Monday, because I can’t do something like this by myself. I realise it’s probably a bit late to try to get something big going at this point but hopefully we can do something and next year the PoNLUG will be prepared for Software Freedom Day!

Icedove and Enigmail

A tip for any Debian user trying to get PGP to work in Icedove, Debian’s re-branded version of the Thunderbird Mail client: All the tutorials and forums on the internet telling you to install Enigmail from Thunderbird’s Add-on menu won’t work. It’s not there. Enigmail isn’t compatible with your version of Thunderbird, which is… Icedove. The solution is simple but not obvious; Enigmail needs to be installed from the package manager, a simple

aptitude install enigmail

should do the trick! 😉

Finding photos of a known size

Recently I did a friend a favour and installed Linux Mint on her laptop as she was a bit frustrated with Windows. Unfortunately I assumed she’d backed up everything before handing it over to me, so I re-partitioned the whole drive to ext4. She hadn’t.

On the bright side the computer was quite new and the only thing she wanted from the disk were some photos she’d taken. Well, that just made it my lucky day because there just happens to be a tool specifically for recovering photos (and a myriad of other filetypes) from disks that have been written over: TestDisk! Continue reading