serhii.net

In the middle of the desert you can say anything you want

12 May 2021

Day 862

Disable touchpad/keyboard

(Fully rewritten in 2026-05-20)

Keyboard

  • xinput disable "AT Translated Set 2 keyboard"
    • xinput set-prop 12 190 0 as bad alternative where:
      • 190 is the property id for “Device Enabled”
      • 12 is the device id for the keyboard
    • you can use property names as well!
      • xinput set-prop 12 "Device Enabled" 0

Touchpad

  • xinput disable 10
    • on my box its name is “ELAN0683:00 04F3:320B Touchpad”

General syntax

  • xinput disable DEVICE_ID
  • xinput set-prop DEVICE_ID PROPERTY_ID VALUE
    • xinput list to get the device id
    • xinput list-props DEVICE_ID to get the property id

Bonus find ids

xinput list | grep -i "Touchpad" | grep -o "id=[0-9]*" | grep -o "[0-9]*"
xinput list | grep -i "AT Translated Set 2" | grep -o "id=[0-9]*" | grep -o "[0-9]*"

Tinyf rofi script

#!/bin/bash

TOUCHPAD_DEVICE_ID=$(xinput list | grep -i "Touchpad" | grep -o "id=[0-9]*" | grep -o "[0-9]*")
KEYBOARD_DEVICE_ID=$(xinput list | grep -i "AT Translated Set 2 keyboard" | grep -o "id=[0-9]*" | grep -o "[0-9]*")

# options to be displayed
k_on="KBD: enable"
k_off="KBD: disable"
t_on="Touchpad: enable"
t_off="Touchpad: disable"

# options passed to variable
options="$k_on\n$k_off\n$t_on\n$t_off"

selected="$(echo -e "$options" | rofi -lines 5 -dmenu -p "action")"
case $selected in
	$k_on)
		xinput --enable $KEYBOARD_DEVICE_ID;;
	$k_off)
		xinput --disable $KEYBOARD_DEVICE_ID;;
	$t_on)
		xinput --enable $TOUCHPAD_DEVICE_ID;;
	$t_off)
		xinput --disable $TOUCHPAD_DEVICE_ID;;
esac

Dockefile RUN a lot of commands

It’s possible to do this instead of prefixing each command with RUN:

RUN apt-get update && \
    # install base packages
    apt-get install -y -qq apt-utils aptitude wget curl zip unzip sudo kmod git && \
    /usr/bin/python3 -m pip install --upgrade pip && \
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus