Comment 17 for bug 303595

Revision history for this message
Jason Straight (jason-jeetkunedomaster) wrote :

I just wrote a script for /etc/pm/sleep.d that will run gsynaptics-init for all users with an X session running, so it won't matter if you're running multiple X sessions :), everyone can have their own settings, and won't cause a delay with the sleep command while waiting for X to resume.

Here it is if anyone wants to work/tweak or include it with the gsynaptics package:

#!/bin/bash

# Only run on resume/thaw
if [[ ${1} =~ (thaw|resume) ]] ; then

  synaptics() {

    # sleep to give time for X
    sleep 4s

    who | while read line ; do
      a=(${line})
      regex="^:[[:digit:]]"
      if [[ ${a[1]} =~ $regex ]] ; then
        init="sudo -H -u ${a[0]} DISPLAY=${a[1]} gsynaptics-init"
      fi
    done
  }

  # run in background so sleep doesn't hold up resume
  synaptics &
  # disown the job so exiting shell doesn't kill function
  disown %1

fi