Disable touchpad on Ubuntu Linux

Quite annoyingly, I was unable to disable touchpad on laptop through the dedicated fn combination. Bit of googling brought results fast, here’s a simple script I use now for switching on and off.

#!/bin/bash
if [ "$1" = "off" ]; then
    sudo modprobe -r psmouse
elif [ "$1" = "on" ]; then
    sudo modprobe psmouse
else
    echo "usage: $0 [on|off]"
fi

Update: you can also use the following “toggle” script, if you want to avoid having to specify on/off each time:

#!/bin/bash
lsmod | grep psmouse &> /dev/null
if [ "$?" = "1" ]; then
    modprobe psmouse
else
    modprobe -r psmouse
fi

3 responses to “Disable touchpad on Ubuntu Linux

  1. Thanks.

    This script changes the value of “Enable mouse clicks with touchpad” when executed. It can be run with a keyboard combination set in gnome-keybinding-properties:

    #!/bin/bash

    mode=”$(gconftool-2 -g /desktop/gnome/peripherals/touchpad/tap_to_click)”

    if [ $mode == “true” ] ;
    then
    gconftool-2 -s -t bool /desktop/gnome/peripherals/touchpad/tap_to_click false
    else
    gconftool-2 -s -t bool /desktop/gnome/peripherals/touchpad/tap_to_click true
    fi

  2. the toogle script is working , but it requires sudo to be executed , so it won’t be practical to assign it to a shortcut keys.
    i don’t want to type my password each time i want to disable the touchpad.

    any way thanks for the nice tip 🙂

  3. #!/bin/bash
    enabled=`xinput –list-props “PS/2 Generic Mouse” | grep -e “Device Enabled\ (126):\s*1″`

    if [ -n “$enabled” ]; then
    xinput –set-prop “PS/2 Generic Mouse” “Device Enabled” 0
    else
    xinput –set-prop “PS/2 Generic Mouse” “Device Enabled” 1
    fi
    ———————————————————————————-

    that worked for me on Dell N5110

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s