Search code examples
linuxubuntuxserver

Executing bash script on wakeup


Since some time I have a Prolbem with my Linux distribution (Kubuntu 18.04). Every time my linux comes back from standby modus the touchpad is not working properly anymore (can't grab and drag files or other objects).

I already found a solution for my Problem:

modprobe psmouse -r
modprobe psmouse

This code does solve the problem. However, after this the rightclick area which I always disable at sartup is enabled again. I have a script that runs on startup which executes the following:

synclient RightButtonAreaLeft=0
synclient RightButtonAreaTop=0

What I am now trying to do, is to write a script that runs whenever the system is waking up form standby modus. I wrote the script like this:

#!/bin/bash
exec 1> /home/luc/Schreibtisch/update.log 2>&1
set -x

case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0`
    # if no pre suspend action required
    exit 0
    ;;
  post/*)
    echo "Waking up from $2..."

    sh /home/luc/Schreibtisch/test.sh
    sh /home/luc/Schreibtisch/test2.sh
    ;;
esac

Where test.sh runs the modprobe commands and test2.sh runs the synclient commands.

After going to standby modus and waking up again I'm getting the following log:

+ case $1/$2 in
+ echo 'Waking up from suspend...'
Waking up from suspend...
+ sh /home/luc/Schreibtisch/test.sh
+ sh /home/luc/Schreibtisch/test2.sh
Failed to connect to X Server.
Failed to connect to X Server.

And the grabing and draging of the files works perfectly but the rightclick is still enabled.

My question is now if it is possible to execute the synclient commands after the X Server is ready?

Kind regards Pepsilon


Solution

  • It looks like i have found a workaround for the problem of the touchpad not working properly after wakeup.

    In my /etc/modprobe.d/blacklist.conf the module i2c_i801 was blacklisted. After removing this module form the blacklist my touchpad now works fine after standby mode.