我有一台新的戴尔笔记本电脑,我想创建一个键盘快捷方式来禁用和启用触摸板。我该怎么做呢?
此帖子的部分功劳(启用/禁用触摸板)
创建一个新目录/home/USER/bin
,然后使用gedit /home/USER/bin/toggle-touchpad
。注意:将USER替换为您的用户ID。将这些行复制并粘贴到编辑器中:
#!/bin/bash
# NAME: toggle-touchpad
# PATH: /home/$USER/bin
# DESC: Update pulseaudio output device when HDMI TV plugged / unplugged
# CALL: called from Keyboard Shortcut `Super`+`T`
# DATE: Created Dec 23, 2016.
# NOTE: Written for AU question: http://askubuntu.com/questions/863746/keyboard-shortcut-to-disable-the-laptop-touchpad/863750?noredirect=1#comment1333958_863750
# Use device number matching touchpad, in this case 14
if [[ $(xinput list 14 | grep -Ec "disabled") -eq 1 ]]; then
xinput enable 14
DISPLAY=:0 notify-send --urgency=critical --icon=/usr/share/icons/gnome/256x256/status/user-available.png "Touchpad enabled"
else
xinput disable 14
DISPLAY=:0 notify-send --urgency=critical --icon=/usr/share/icons/gnome/256x256/status/user-busy.png "Touchpad disabled"
fi
exit 0
保存文件并退出编辑器。现在使用标记文件为可执行文件chmod +x /home/USER/bin/toggle-touchpad
打开System Settings
⟶ Keyboard
⟶ Shortcuts
⟶ Custom Shortcuts
⟶+
出现此屏幕:
填写“自定义快捷方式”字段,如下所示:
Toggle Touchpad
/home/USER/bin/toggle-touchpad
点击Apply按钮保存。
出现新条目,其状态为Disabled。右键单击“禁用”,然后使用Super+ Z(或任何其他未使用的快捷键组合)。我想使用Super+,T但是已经分配给Nautilus Trashcan了。
默认设备号设置为14。要了解您的设备号是什么,请使用以下命令:
───────────────────────────────────────────────────────────────────────────────
USER@host:~/bin$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Performance MX id=10 [slave pointer (2)]
⎜ ↳ Logitech K800 id=11 [slave pointer (2)]
⎜ ↳ AlpsPS/2 ALPS GlidePoint id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Laptop_Integrated_Webcam_HD id=12 [slave keyboard (3)]
↳ Dell WMI hotkeys id=15 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
───────────────────────────────────────────────────────────────────────────────
USER@host:~/bin$
您可以选择任何喜欢的设备,例如Touchpad = 14,Webcam = 12,依此类推。
您使用哪个设备号,只需打开/home/USER/bin/toggle-touchpad
脚本并替换14
为该设备号即可。
当显示“启用触摸板” /“禁用触摸板”通知提示框时,文本左侧会显示一个图标。使用了库存图标,/usr/share/icons/gnome/256x256/status/
但可以更改它们。
要启用触摸板,将显示以下内容:
要禁用触摸板,将显示以下内容:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句