启动时禁用部分触摸板

启动时禁用部分触摸板

多年来,我一直在 Mint 启动时手动禁用东芝 Z30 上触摸板的“棒”部分。该型号存在鼠标自行移动的硬件问题。

现在已多次尝试让此命令在启动时自动运行(对于所有用户),但它不起作用。

创建了一个具有执行权限的脚本:

ls -la /etc/init.d/disable-stick.sh
-rwxr-xr-x 1 root root 84 Feb 28 07:21 /etc/init.d/disable-stick.sh

其内容是:

$ cat /etc/init.d/disable-stick.sh

xinput disable 'AlpsPS/2 ALPS DualPoint Stick'
echo "Just ran disable stick script"

这里被称为:

$ ls -la /etc/rc.local

-rwxr-xr-x 1 root root 345 Feb 28 07:16 /etc/rc.local

其中有以下内容:

$ cat /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/etc/init.d/disable-stick.sh || exit 1
exit 0

我真的认为这应该有效,已经查看了很多来源。它几乎可以运行,可以在启动日志中看到:

$ tail -n 100 /var/log/boot.log

[  OK  ] Started MySQL Community Server.
[FAILED] Failed to start Load/Save RF Kill Switch Status.
See 'systemctl status systemd-rfkill.service' for details.
[  OK  ] Started Network Manager Wait Online.
[  OK  ] Reached target Network is Online.
         Starting Docker Application Container Engine...
         Starting /etc/rc.local Compatibility...
         Starting TeamViewer remote control daemon...
         Starting LSB: disk temperature monitoring daemon...
         Starting LSB: Start NTP daemon...
         Starting LSB: VirtualBox Linux kernel module...
         Starting LSB: Starts and daemonize Glances server...
[  OK  ] Started LSB: disk temperature monitoring daemon.
[  OK  ] Started LSB: Starts and daemonize Glances server.
[   40.068428] rc.local[1373]: Unable to connect to X server
[   40.068683] rc.local[1373]: Just ran disable stick script
[  OK  ] Started /etc/rc.local Compatibility.
         Starting Hold until boot process finishes up...
         Starting Terminate Plymouth Boot Screen...
[  OK  ] Started LSB: Start NTP daemon.

“无法连接到 X 服务器”- 不太正确。知道如何让它发挥作用吗?

更新:

这个小脚本/etc/init.d/disable-stick.sh肯定有效,我在登录后在终端中测试了它,并且鼠标停止移动。只是不确定它是否在启动时的正确位置触发..

答案1

我已经解决了这个问题,在我登录我的用户之前,该解决方案不会启动,鼠标在登录之前仍然表现不佳,但幸运的是,该命令在登录时运行。这是一种与汽车警报器关闭时类似的轻松感。也不必总是在终端中输入该命令,这也是一种解脱。

使用 linux mint 中的 GUI,我在启动程序中添加了一个项目,如下所示: 将项目添加到 linux mint 启动程序

使用命令(Befehl)看不到的那一行是:

xinput disable 'AlpsPS/2 ALPS DualPoint Stick'

添加后,出现在列表中:

linux mint 启动程序菜单中包含新项目

这样做会在自动启动文件夹中添加一个文件

$ ls ~/.config/autostart/
blueman.desktop        hplip-systray.desktop            mintupload.desktop
Brightness.desktop     mint-ctrl-alt-backspace.desktop  mintwelcome.desktop
disable stick.desktop  mintupdate.desktop               shutter.desktop

创建的文件的内容disable\ stick.desktop是:

[Desktop Entry]
Type=Application
Exec=xinput disable 'AlpsPS/2 ALPS DualPoint Stick'
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[de_DE]=disable stick
Comment[de_DE]=switches off the trackpad at start
X-GNOME-Autostart-Delay=0

现在我们可以看到以编程方式实现这一目标需要什么。目前我对这个解决方案感到满意,但我想知道它是否可以在登录屏幕本身之前运行,以及它是否为登录的其他用户运行(我猜不是)。

相关内容