Created
December 18, 2020 06:22
-
-
Save pinbo/48372ba323629199b646ea58fbf036e5 to your computer and use it in GitHub Desktop.
A simple script to toggle on/off laptop touchpad on Gnome Desktop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# the code is written by steeve.mccauley from: https://extensions.gnome.org/extension/935/toggle-touchpad/ | |
# I tested on Gnome 3.38.2 on 2020-12-17. It works perfectly. | |
# Then added a keyboard shortcut to easy run the script to turn on or off the laptop touchpad. | |
class=org.gnome.desktop.peripherals.touchpad #location in gconf settings where the touchpad is en/disabled | |
name=send-events #name of the actual setting | |
status=$(gsettings get "$class" "$name") | |
status=${status,,} # normalize to lower case; this is a modern bash extension | |
echo Current status is $status | |
if [[ $status = "'disabled'" ]]; then # needs " ' '" to work | |
echo it is off | |
new_status=enabled # ' not required | |
else | |
new_status=disabled | |
fi | |
echo "Toggling to $new_status" | |
gsettings set "$class" "$name" "$new_status" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment