0

I wrote a script which greps through the output of synclient to determine whether a laptop's touchpad has miraculously turned itself off (Ubuntu seems to /love/ doing this recently) and, if so, turns it back on.

The script is something like this:

#!/bin/bash
while true ; do
    if [ `synclient | grep -e"TouchpadOff[\s]*1" | wc -l` -ge 1 ] ; then
        synclient TouchpadOff=0
    fi
    sleep(3)
done

(I don't have the laptop to hand right now but you get the point! I will update later when I'm at my laptop if that's incorrect)

So I tried running this as an upstart script so my touchpad can heal itself without any interaction. But it seems synclient doesn't find the current user's X session when my script is upstart'ed.

I tried running it by using something like su -c myscript.sh ledneb in my script stanza, but to no avail.

Should I be looking in the direction of /etc/X11/xinit/xinitrc rather than upstart?

Is there a proper way to have this script run in the context of the current (or even a hard-coded) user's x session?

ledneb
  • 169
  • 6

1 Answers1

1

You can do what you are asking...

... but I'm not sure this is the right approach. If you have not already done so, please consider reporting the issue in Ubuntu so it can be fixed as the behaviour you describe sounds like a bug.

jamesodhunt
  • 849
  • 5
  • 4