Is there a problem with the touchpad reacting while entering characters and causing incorrect typing? I have In most cases, Windows has a shortcut to enable / disable the touchpad, but Linux Mint doesn't seem to have it. It's annoying to write sentences and source code, so I wrote a shell for shortcuts and registered it as a shortcut. If you have any questions or improvements, please feel free to comment.
OS LinuxMint 19.3 Cinamon PC ASUS E203
① Prepare a shell ② Register to shortcut
You can use an appropriate file name, so prepare an sh format file and copy and paste the following code into it. However, for the device name, obtain the device name of the touchpad by the method described later and replace it.
toggleTotchpad.sh
#!/bin/bash
#Enter the device name of the touchpad.
TOUCHPAD="(Device name)"
#If the value below is 1, the touchpad is valid. If it is 0, it is invalid. Put 1 at first
isTouchpadEnable=1
#Get the current state of the touchpad
touchpadStateStr=$(xinput list-props "$TOUCHPAD" | grep "Device Enabled")
touchpadStateStrLength=$((${#touchpadStateStr}-1))
touchpadState=${touchpadStateStr:$touchpadStateStrLength:1}
#The current state of the touchpad is valid (=1) is invalid (1)=Substitute 0 to make it 0)
if [ "$touchpadState" = "1" ];then
isTouchpadEnable=0
fi
#Enable / disable the touchpad
xinput set-prop "$TOUCHPAD" --type=int --format=8 "Device Enabled" $isTouchpadEnable
I did a lot of research, but the one using xinput was the easiest to understand, so I used it. It's a very powerful code, so I'd be happy if you could let me know if there are any corrections.
You can get the device name of the touchpad in the above shell with the following command. Even if you say acquisition, only a list of connected input devices will appear, so look for the one that ends with Touchpad.
xinput --list
The link below will be helpful. http://www7b.biglobe.ne.jp/~nishigo/linux/Disable_of_touchpad2.html
Open the keyboard shortcut settings from the menu bar.
Click Add and enter a name and command. The name can be anything you know. Enter the command as shown below.
bash (Absolute path of sh made in ①)
I think that the registered shortcut is invalid, so click on it and register your favorite shortcut, and you're done. I chose Windows Key + T. This is a reference link. https://www.shangtian.tokyo/entry/2019/01/05/104136
Recommended Posts