2

I am trying to run a script after resuming from suspend. I need this script to disable the right click in the touchpad and to fix a problem of my wifi. Accordingly to How to run script after resume and after unlocking screen I placed a script called autorun.sh in /etc/pm/sleep.d:

#! /bin/bash 
case "$1" in
hibernate|suspend)
    sudo -u giorgio env DISPLAY=:0 zenity --info synclient TapButton2=0
    sudo -u giorgio env DISPLAY=:0 zenity --info modprobe iwlagn 11n_disable=1
    exit
    ;;
thaw|resume)
    sudo -u giorgio env DISPLAY=:0 zenity --info synclient TapButton2=0
    sudo -u giorgio env DISPLAY=:0 zenity --info modprobe iwlagn 11n_disable=1
exit
;;
esac
exit

The problem is that when I resume, I realize that the script didn't actually work (the right click is not disabled) and in the log file /var/log/pm-suspend.log I have this lines:

Running hook /etc/pm/sleep.d/autorun.sh resume suspend:

(process:15304): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

(process:15310): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

What I am missing? Thanks in advance.

gg-79
  • 610

1 Answers1

1

Try this:

#!/bin/bash 
case "$1" in
    hibernate|suspend|thaw|resume)
        export DISPLAY=:0.0
        sudo -u giorgio synclient TapButton2=0
        sudo -u giorgio modprobe iwlagn 11n_disable=1
        ;;
esac

A few things.

  • You had two branches to your case statement, but they both did the same thing, so I shortened it to a single branch. I don't think that you can have anything other than hibernate|suspend|thaw|resume, but just in case, I left it there.
  • As per my comments, you don't need exit.
  • I'm not 100% sure what env DISPLAY=:0 does, but I replaced it with something that I know works (and is more concise).
  • As per my comments, zenity is for creating dialogue boxes, so I think you must have gotten a bit confused somewhere.
Sparhawk
  • 6,969