Backup/restore XFCE desktop icons

Sometimes the XFCE desktop icons get messed up, for example by games that temporarily change the screen resolution to 800×600.

A solution to this problem has been mentioned here. It suggests using “sudo chattr +i” to lock the config file where XFCE stores the icon positions.

Alternatively (and without the repeated need for sudo and chattr) you can also backup and restore the ~/.config/xfce4/desktop/icons* file(s) like this:

Create a script /usr/local/bin/save-xfce-desktop-icons.sh like this:

#! /bin/sh
mkdir -p ~/.config/xfce4/desktop.bak
cp -f ~/.config/xfce4/desktop/icons* ~/.config/xfce4/desktop.bak

Create another script /usr/local/bin/load-xfce-desktop-icons.sh like this:

#! /bin/sh
cp -f ~/.config/xfce4/desktop.bak/icons* ~/.config/xfce4/desktop

Make the scripts executable like this

sudo chmod ugo+x /usr/local/bin/save-xfce-desktop-icons.sh
sudo chmod ugo+x /usr/local/bin/load-xfce-desktop-icons.sh

Then in the XFCE start menu, go to “Settings” – “Keyboard” – “Application Shortcuts” and configure 2 keyboard shortcuts:

Command Shortcut
save-xfce-desktop-icons.sh <Control><ALT>S
load-xfce-desktop-icons.sh <Control><ALT>L

Then you will be able to backup and restore your icons like this:

  • Backup: Press F5 then <Control><ALT>S then F5
  • Restore: Press F5 then <Control><ALT>L then F5

The F5 is necessary to synchronize what you see on the screen with the content of ~/.config/xfce4/desktop/icons*.

Tested old-o.github.io on all major browsers

I just tested my personal “résumé” – British folks would say “CV” – website at old-o.github.io successfully on IE8, IE9, Firefox 3.6 to 9, latest and older Chrome versions, Opera 10 and 11 and Safari 4 and 5.1. It works on all browsers and looks fine.

You might wonder if I have all these browser installed? No, I don’t. I used the amazing browserling.com service that runs all the various browsers in virtual machines “in the cloud”, and embeds the UI in their website. Cool stuff and currently free for everyone to use!

One caveat with browserling.com is a tool called IETester that they use to emulate the ancient IE5.5 and IE6 browsers. Its seems to have bugs related to PNG graphics which prevented reliable testing. So if anyone out there still uses IE5.5 or IE6: Please visit old-o.github.io and let me know if you can see the photo of me on the page with the transparency effect.

On the newer CSS3 capable browsers, my site now sports drop shadows and rounded corners, using border-radius and box-shadow.

I also tested W3C standards compliance (HTML5, CSS3) and all my pages did pass those tests as well, except for some stuff caused by bugs in the CSS3 validator at w3.org. What a nice way to end the computer oriented part of the day …

My /etc/apt/sources.list (for Debian squeeze)

My sources.list entries:

# local repo (manually downloaded debs, etc.):
deb file:/usr/local/packages ./

# The closest Debian mirror is at Dalhousie University, Halifax:
deb http://mirror.its.dal.ca/debian/ squeeze main contrib non-free
deb http://mirror.its.dal.ca/debian/ squeeze-updates main
deb http://mirror.its.dal.ca/debian/ squeeze-proposed-updates main
# See http://www.debian.org/mirror/list for mirrors closer to you

# Security updates (not mirrored)
deb http://security.debian.org/ squeeze/updates main

# Official backports repo for squeeze (I install the Linux kernel from it)
deb http://backports.debian.org/debian-backports squeeze-backports main

# Debian multimedia, a must-have for mplayer et al.
deb http://mirror.its.dal.ca/debian-multimedia squeeze main non-free

# Repo that provides latest Iceweasel (aka Firefox)
deb http://mozilla.debian.net/ squeeze-backports iceweasel-release

Simple webradio playback

I listen to web radio stations but I don’t want to use any player ui for that. All I want is:

  1. Select a station from a list of my favorites and listen to it
  2. Be able to stop current web-radio playback
  3. Never have more than one station playing at the same time

I do it like this:

  • For each radio station save a playlist file (*.pls, *.m3u or sometimes *.asx) in a folder called “radio” on my local machine. I download most of them from the shoutcast or icecast stream directories. I also add one special (empty) file called “none.pls” (which serves to turn off all radio).
  • Add a toolbar to the taskbar that lists the content of the radio folder, i.e. all the webradio playlist files as clickable items. In XFCE add a “Directory Menu” item to the panel.
  • Configure the default app for the playlist mime types mentioned above to be my bash script “radio.sh”. It kills any existing webradio playback and plays the selected playlist file. See below for how to configure mime-type association defaults.
  • Install mpv – the de-facto successor of the now dormant mplayer – to do the actual playback.

This is my little “radio.sh” script (requires the pkill and mpv commands):

#! /bin/bash
pkill -f "mpv --playlist" 
mpv -playlist "$@"

To set this script as the default handler for the most common playlist file types, put the following into ~/.local/share/applications/defaults.list:

[Default Applications]
audio/x-mpegurl=radio.sh.desktop
audio/x-scpls=radio.sh.desktop

Make sure you have a file “radio.sh.desktop” in ~/.local/share/applications or in /usr/local/share/applications with contents like this:

[Desktop Entry]
Exec=radio.sh %U
MimeType=audio/x-mpegurl;audio/x-scpls;video/x-ms-asf
Name=radio.sh
StartupNotify=false
Terminal=false
Type=Application

If I have to use M$ Windows then I do something similar using a taskbar toolbar for the radio folder and the VLC player, configured to run minimized as systray icon.

APT pinning, Iceweasel upgrade, hide Facebook Ads

I am a pretty happy user of Debian 5 stable (“Lenny”). But some Lenny packages are a little too old for my taste.

For example, Iceweasel is version 3.0.6 in Lenny. But the latest Adblock Plus (1.1.1 and later) requires Firefox/Iceweasel 3.0.12 and Adblock Element Hiding Helper does not work correctly with Adblock Plus versions older than 1.1.1 (keeps ignoring the configured hiding patterns).

So I decided that I want Iceweasel 3.0.14 from Debian testing (“Squeeze”). I googled for APT Pinning and found this page

http://wiki.debian.org/AptPinning

The lower half of it explains a “conservative approach” to pinning that only installs testing packages when the user explicitly requests it. I created /etc/apt/preferences to look like this:

Package: *
Pin: release a=stable
Explanation: prefer stable
Pin-Priority: 900

Package: *
Pin: release o=Debian
Explanation: require approval
Pin-Priority: -10

Then I added the Debian testing repository to /etc/apt/sources.list, told apt to update itself and installed Iceweasel from testing:

apt-get update
apt-get install -t testing iceweasel

That worked nicely and upgraded only the Iceweasel package, nothing else.

Now I can use Adblock Plus with the Element Hiding Helper to get rid of the ads in Facebook by adding these Element Hiding Rules:

facebook.com##DIV.adcolumn
facebook.com##DIV.UIEMUASFrame.UIEMUASSLikeFrame
facebook.com##DIV.UIEMUASFrame

Yay! That was worth the effort …