CrunchBang tint2 moving icon workaround

Posted by

One small bug I’ve noticed while using CrunchBang on several laptops is that the icons at the top-right creep a space left on resume. Others have noticed it too. If you sleep and wake your laptop often, as I do, the icons can end out practically mid-screen throughout the course of the day. It’s purely cosmetic, but is rather annoying.

The bug appears to be in xfce4-power-manager package. However, a lazy workaround is to restart tint2. The following automates this. It doesn’t fix the problem but it does address the symptom perfectly.

First, we become root and create a simple helper script:

  • sudo su
  • echo '#!/bin/sh' > /usr/local/bin/xpm_workaround.sh
  • echo echo 'sleep 3; su $1 -c "killall -SIGUSR1 tint2" &' >> /usr/local/bin/xpm_workaround.sh
  • chmod 755 /usr/local/bin/xpm_workaround.sh

Next, we create a pm-utils script:

  • vi /etc/pm/sleep.d/10_xpm_workaround

It should look like this:

#!/bin/sh
# tint2 restart for x-p-m bug

USER=$(who | grep pts\/0| awk '{print $1}')

case "$1" in
hibernate|suspend)
;;
thaw|resume)
/usr/local/bin/xpm_workaround.sh $USER &
;;
*) exit $NA
;;
esac

Now we set permissions and we should be done.

  • chmod 755 /etc/pm/sleep.d/10_xpm_workaround
  • chown root:root /etc/pm/sleep.d/10_xpm_workaround

That’s it. The pm script assumes that the first user logged in is who needs to run the script. There may be a cleaner way to do this, but it works on my machines.

GoSaBe Blog - Jan 19, 2012 | Linux