a weblog about programming, hacking, linux, and other randomness

My Photo
I'm a Programmer, Hobby Hacker, and Linux Freak.

Friday, January 27, 2012

xfce-do

Since switching to Xubuntu I've found myself using xfce4-appfinder in place of Gnome-Do. Bind this script to <Super>+<Space> in Settings Manager→Keyboard→Application Shortcuts in order to run it as a single instance.
#!/bin/bash
pidfile=/var/run/xfce-do/pid
if [ -e $pidfile ]; then
    pid=`cat $pidfile`
    if kill -0 &>1 > /dev/null $pid; then
        exit 1
    else
        rm $pidfile
    fi
fi
echo $$ > $pidfile
xfce4-appfinder
rm $pidfile

Make sure to create the directory and provide write permissions to users.

sudo mkdir /var/run/xfce-do
chmod a+w /var/run/xfce-do