# GNOME Workspace Wraparound

I found out yesterday that GNOME (or more correctly, the GNOME window manager, Metacity) only allows you to switch to a specific workspace. You cannot cycle through workspaces, wrapping around to the first when on the last. There is a long-standing upstream bug report, about this issue, but sadly it is marked as wontfix.

I have, however, found a workaround using wmctrl. These commands could obviously be much nicer if they were placed in a proper script, but I wanted a one line snippet that I could add to my xbindkeys config. This allows me to execute these commands using keyboard shortcuts.

# Workspace Increment
wmctrl -s $(($(( $(wmctrl -d | sed -n 's/^ *\*.*/\1/p') + 1 )) & 3 )) # Workspace Decrement wmctrl -s$(( $(($(wmctrl -d | sed -n 's/^ *\*.*/\1/p') - 1 )) & 3 ))


Note: In order to minimise the calls to wmctrl, I've hardcoded my number of workspaces (4 in my case) as a bitwise AND in the last portion of these commands.

# XML reindent

XML is designed to be human-readable. However, to minimise data transfer, the indentation and newline characters are often discarded during transmission. This results in a difficult-to-read XML file such as the one below:

<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from>
<heading>Reminder</heading><body>Don't forget me this weekend!</body></note>

This XML file can be both checked for validity, and reindented using xmllint. Debian/Ubuntu users can find this as part of the libxml2-utils package.

xmllint --format input.xml > output.xml


This results in the following, more-sane output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>


# OpenJDK System Proxy

By default, OpenJDK, the default Java virtual machine used by Debian and Ubuntu, does not obey system-wide proxy settings.

To rectify this, edit /etc/java-6-openjdk/net.properties, and change

java.net.useSystemProxies=false

to true.

# Thunderbird Movemail Support

I discovered the other day that Thunderbird supports Unix Movemail accounts. It seems to have supported them for a long while, but it wasn't very obvious from the Account options. This is dead handy as it allows me to retrieve the various system generated emails from /var/spool/mail automatically.

# GNU Screen Autostart

I got a Debian based VPS recently, and every so often I find myself needing to reboot the server. I keep forgetting to start my GNU Screen and Irssi windows again though.

Adding the following line to /etc/rc.local allows GNU Screen to automatically run at boot time. This line runs Screen from my unpriviledged account, loads Irssi within that Screen, and then backgrounds itself, ready for the next time I login.

/bin/su unprivilegeduser -c "/usr/bin/screen -dmS sessionname /usr/bin/irssi"

EDIT: I've since ditched Screen in favour of tmux, and moved to a crontab for starting irssi after restarts.

Place the following in your local crontab file:

@reboot /usr/bin/tmux new-session -d -n irssi /usr/bin/irssi