1

I have my touchpad configured to register a 3 finger tap as middle-click using

synclient TapButton3=2

This works well, so I have set this command up to automatically run some seconds after login months ago already, using the Startup Applications GUI tool. This is how the relevant files look:

$ cat .config/autostart/touchpad-settings.sh.desktop 
[Desktop Entry]
Type=Application
Exec=bash -c 'sleep 7 ; /usr/local/bin/touchpad-settings.sh'
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Touchpad settings
Comment=

$ cat /usr/local/bin/touchpad-settings.sh
#! /bin/bash
synclient TapButton3=2

So this worked fine all the time, but since a few days or maybe weeks ago, the configuration gets reset after suspending the laptop and waking it up again. 3 finger tapping then opens an Alt+Tab-like window switcher instead of producing a middle-click and querying synclient for this settings value confirms that TapButton3=0 again.

Any idea what might have caused this? How can I fix it or at least automatically reconfigure it after waking up from suspend?

0

I have no idea what causes it, but it can be solved quickly.

You can write a script and let it be executed every time after suspend. Here's how it works:

First, create a script that contains your touchpad settings. Mine looks like this:

#!/bin/bash 
#=============
# touchpad.sh
#=============
# This script sets up my touchpad settings at login/after suspend
# Executed from /lib/systemd/system-sleep

# wait for a few seconds for the desktop to be set up properly first
sleep 5;

# synclient needs a server to connect to
declare -x DISPLAY=":0.0"
declare -x XAUTHORITY="/home/<YOUR USERNAME>/.Xauthority"

# enable middle click
synclient TapButton2=3 
synclient TapButton3=2

# disable window switcher
synclient ClickFinger3=2

exit 0

Don't forget to insert YOUR USERNAME and to make the script executable: chmod a+x /path/to/script/touchpad.sh

Next, you create a script that will launch touchpad.sh after suspend. For ubuntu 16, you'll need to save it in the /lib/systemd/system-sleep/ directory. This is what mine looks like:

#!/bin/sh
case $1 in
  pre)
    # Place your pre suspend commands here, or `exit 0` 
    # if no pre suspend action required
    exit 0
    ;;
  post)
    # Place your post suspend (resume) commands here, or 
    # `exit 0` if no post suspend action required
    /path/to/script/touchpad.sh
    exit 0
    ;;
esac

You'll need root permissions to write into /lib/systemd/system-sleep/, and again don't forget to make the script executable with sudo chmod a+x your_wakeup_script.sh

Lastly, credits where credits are due.

| improve this answer | |
  • this approach doesn't seem to try to get to the crux of the matter – Entea Nov 21 '18 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.