Touchpad enable/disable script and shortcut on Ubuntu 18.10

If your laptop doesn’t have a working switch for turning on/off your touchpad, then this post is for you.

Create a script called disenable_touchpad.sh and add the following code to it:

!/bin/bash

state=$( gsettings get org.gnome.desktop.peripherals.touchpad send-events )

if [ "$state" == "'enabled'" ];then
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'disabled' \
&& notify-send -i touchpad-disabled-symbolic "Touchpad" "Disabled"
else
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'enabled' \
&& notify-send -i input-touchpad-symbolic "Touchpad" "Enabled"
fi

Mark the script as executable and move it to /usr/bin:

chmod +x disenable_touchpad.sh
sudo mv disenable_touchpad.sh /usr/bin/

Open Settings -> Keyboard, scroll to the bottom and press the + sign to assign a new keyboard shortcut:

Tested on Ubuntu 18.10, should work on any gnome-shell versions anyway!

Enjoy!

Sources: https://askubuntu.com/questions/844151/enable-disable-touchpad/1109515#1109515

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Linux and tagged , , , , . Bookmark the permalink.

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 )

Facebook photo

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

Connecting to %s