Quantcast
Channel: sleeplessbeastie's notes
Viewing all articles
Browse latest Browse all 770

How to disable touchpad using shortcut

$
0
0

I have already described how to disable touchpad when external mouse is connected using udev device manager, but today I want to share a simple shell script that I am using on Dell XPS 13 to disable/enable touchpad using single keyboard shortcut.

Ubuntu - Keyboard shortcuts
Ubuntu - Keyboard shortcuts

Use the following shell script to disable/enable touchpad depending on its current state.

#!/bin/sh
# Shell script used to to disable/enable touchpad using single keyboard shortcut
# Source: https://blog.sleeplessbeastie.eu/2016/07/11/how-to-disable-touchpad-using-shortcut/

# get device id
device_id="$(xinput list | sed  -ne '/DLL0665:01 06CB:76AD Touchpad/ s/.*id=\([0-9]*\).*/\1/p')"

if [ -n "${device_id}" ]; then
  # verify current state, set action
  check_state=$(xinput list ${device_id} --long | grep "This device is disabled")
  if [ -n "${check_state}" ]; then
    action="enable"
  else
    action="disable"
  fi

  # execute action
  xinput ${action} ${device_id}
fi

Define custom keyboard shortcut to switch touchpad back and forth.


Viewing all articles
Browse latest Browse all 770

Trending Articles