Ubuntu切换触摸板状态脚本

#!/bin/bash

touchpad_id=$(xinput list | grep 'Touchpad' | grep -oE 'id=([0-9]+)' | grep -oE '[0-9]+') 
touchpad_state=$(xinput list-props "$touchpad_id" | grep "Device Enabled" | grep -Eo '.$')

# change 0 to 1 or 1 to 0
xinput set-prop "$touchpad_id" "Device Enabled" $((($touchpad_state + 1) % 2))

你可能感兴趣的:(Ubuntu切换触摸板状态脚本)