在 Ubuntu 16.04 LTS 上唤醒后触摸屏会自动重新启用

在 Ubuntu 16.04 LTS 上唤醒后触摸屏会自动重新启用

我在启动应用程序中添加了一个启动命令,以便在每次启动时禁用触摸屏,因为它偶尔会出现严重混乱输入的问题:

xinput disable "ELAN Touchscreen"(我不使用设备 ID,因为它们每次重启后都会改变)。

但是,唤醒几次后,触摸屏又会打开。有什么办法可以解决这个问题吗?

答案1

使用编辑文件

sudo nano /usr/share/X11/xorg.conf.d/10-evdev.conf

将 MatchIsTouchscreen 从“开”更改为“关”,使其看起来像这样

Section "InputClass"
  Identifier "evdev touchscreen catchall"
  MatchIsTouchscreen "off"
  MatchDevicePath "/dev/input/event*"
  Driver "evdev"
  EndSection

保存、命名并退出 nano

“ELAN 触摸屏”已被禁用,并且不再在 xinput 列表中检测到。

答案2

当您的系统“唤醒”(从挂起或休眠状态恢复)时,它通过“电源管理”进行。阅读man pm-action其中的部分内容:

   /etc/pm/sleep.d, /usr/lib/pm-utils/sleep.d
       Programs in these directories (called hooks) are combined and
       executed in C sort order before suspend and hibernate with as
       argument 'suspend' or 'hibernate'. Afterwards they are called in
       reverse order with argument 'resume' and 'thaw' respectively. If
       both directories contain a similar named file, the one in
       /etc/pm/sleep.d will get preference. It is possible to disable a
       hook in the distribution directory by putting a non-executable file
       in /etc/pm/sleep.d, or by adding it to the HOOK_BLACKLIST
       configuration variable.

您可以将脚本的可执行副本(准备处理参数“suspend”、“hibernate”、“resume”或“thaw”)放入/etc/pm/sleep.d

相关内容