The two finger touch feature on my Asus laptop is being problematic, as described in this other question.

While I wait to see if anyone answers that, I thought of a workaround in the meantime. If I could toggle the two finger feature on and off, that would work well enough.

In my Gnome/Nautilus settings, I have these interface options:

touchpad options

Is there any way I can make that "Two finger scroll" option accessible with a shortcut key?

I'm using Gnome Flashback with Compiz and Nautilus on Ubuntu 14.


Toggle two-finger-scroll; a script

The current settings can be read with the command:

gsettings get org.gnome.settings-daemon.peripherals.touchpad scroll-method

To set an altered setting:

gsettings set org.gnome.settings-daemon.peripherals.touchpad scroll-method <'new-value'>

What the script does

The script below reads the current settings and alters it, depending on the current setting, thus toggling between "two-finger-scrolling" enabled/disabled.

To use it:

  1. Paste it into an empty file, save it as toggle_scroll.py
  2. Test-run it by the command:

    python3 /path/to/toggle_scroll.py
  3. If all works fine, add it to a shortcut key: add shortut key. Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command to a (available) key combination.


I was not sure if "disabled" in your case should be edge-scrolling or disabled. I assumed the last. If not, change the line:

cmd = set_cmd+key+" "+disabled1 


cmd = set_cmd+key+" "+disabled2

The script

#!/usr/bin/env python3
import subprocess

# define command sections, key
get_cmd = "gsettings get "; set_cmd = "gsettings set "
key = "org.gnome.settings-daemon.peripherals.touchpad scroll-method"
enabled = "'two-finger-scrolling'"
disabled1 = "'disabled'"; disabled2 = "'edge-scrolling'"
# get current value
get = lambda cmd: subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8").strip()
current = get(get_cmd+key)
# toggle, depending on current setting
cmd = set_cmd+key+" "+disabled1 if current == enabled else set_cmd+key+" "+enabled
subprocess.Popen(["/bin/bash", "-c", cmd])
  • This is great, thank you! I actually ended up setting the shortcut in the Compiz configuration interface, because the System Settings one would not work for me for some reason. Also, different programs seem to impact the script in some way. In Firefox, the toggle works pretty much exactly as expected. In Gedit, sometimes it works perfectly and other times it seems to delay, or not work. But I just mention those by way of documentation, not because it's unsatisfactory in any way. It's awesome, and I really appreciate you making this code available. – Questioner Mar 9 '15 at 5:43
  • @Jacob: And another problem pythoned! (and another answer upvoted!) – Fabby Mar 12 '15 at 21:35

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.