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/
  • echo echo 'sleep 3; su $1 -c "killall -SIGUSR1 tint2" &' >> /usr/local/bin/
  • chmod 755 /usr/local/bin/

Next, we create a pm-utils script:

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

It should look like this:

# tint2 restart for x-p-m bug

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

case "$1" in
/usr/local/bin/ $USER &
*) exit $NA

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