我决定设置一个简单的 bash 脚本来自动设置我的 Wacom 数位板,但我遇到了一些问题。这是文件:
#!/bin/bash
#Used to setup my Wacom Tablet (Intous Draw)
xsetwacom --list
echo "Setting up Wacom Tablet..."
sudo modprobe -r wacom
sudo modprobe -r wacom_w8001
sudo modprobe wacom
sudo modprobe wacom_w8001
echo "Configuring pen buttons..."
xsetwacom set "Wacom Intuos S 2 Pen stylus" Button 2 key +space
echo "Configuring tablet buttons..."
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 1 key +ctrl z -ctrl
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 3 key +ctrl
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 8 key +ctrl +shift z -shift -ctrl
xsetwacom set "Wacom Intuos S 2 Pad pad" Button 9 key +alt +shift +ctrl k -ctrl -shift - alt
echo "Mapping tablet to DVI-0..."
xsetwacom set "Wacom Intuos S 2 Pen stylus" MapToOutput DVI-0
echo "Done!"
exit 0
如果我手动输入这些命令,它们可以正常工作,没有错误,但是一旦我将它们放入 bash 脚本并运行它,就会出现以下错误:
Wacom Intuos S 2 Pen stylus id: 13 type: STYLUS
Wacom Intuos S 2 Pad pad id: 14 type: PAD
Setting up Wacom Tablet...
Configuring pen buttons...
Cannot find device 'Wacom Intuos S 2 Pen stylus'.
Configuring tablet buttons...
Cannot find device 'Wacom Intuos S 2 Pad pad'.
Cannot find device 'Wacom Intuos S 2 Pad pad'.
Cannot find device 'Wacom Intuos S 2 Pad pad'.
Cannot find device 'Wacom Intuos S 2 Pad pad'.
Mapping tablet to DVI-0...
Cannot find device 'Wacom Intuos S 2 Pen stylus'.
Done!
第一个命令列出了可用的设备(以确保它已连接),其他命令是设置按钮并映射到我的显示器。我已经确保拼写正确,并且命令编写正确,但它仍然不起作用。使用sudo
也无济于事。xsetwacom
不需要任何root权限。