Как заблокировать часы?

Решение - автоматическое

Благодаря Esamo и его работе.

Чтобы добавить триггеры AUTO для подключения мыши при запуске:

Создайте файл: /etc/udev/rules.d/10-local.rules

Заполните это содержимое: (замените $ USER своим именем пользователя)

ACTION=="add", SUBSYSTEM=="input", KERNEL=="mouse[0-9]", ENV{DISPLAY}=":0",ENV{XAUTHORITY}="/home/$USER/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/$USER/scripts/touchpad_switcher.sh false"

ACTION=="remove", SUBSYSTEM=="input", KERNEL=="mouse[0-9]", ENV{DISPLAY}=":0",ENV{XAUTHORITY}="/home/$USER/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/$USER/scripts/touchpad_switcher.sh true"

Решение - автоматическое

ACTION=="add", SUBSYSTEM=="input", KERNEL=="mouse[0-9]", ENV{DISPLAY}=":0",ENV{XAUTHORITY}="/home/dawid/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/dawid/scripts/touchpad_switcher.sh false"

ACTION=="remove", SUBSYSTEM=="input", KERNEL=="mouse[0-9]", ENV{DISPLAY}=":0",ENV{XAUTHORITY}="/home/dawid/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/dawid/scripts/touchpad_switcher.sh true"

Затем поместите свой сценарий там, где хотите. Я поместил его в ~ / scripts

touchpad_switcher.sh

#!/bin/sh
enabled=$1
touchpad_id=$(xinput | grep -i "touchpad" | cut -f2 | cut -d '=' -f2);

if $enabled
then
  xinput set-prop $touchpad_id "Device Enabled" 1 | notify-send "The touchpad is now enabled." ""
else
  xinput set-prop $touchpad_id "Device Enabled" 0 | notify-send "Disabling the touchpad..." ""
fi

touchpad_switcher.sh

chmod +x touchpad_switcher.sh [!d13 ]

Теперь просто перезагрузитесь! (просто перезапуск udev, похоже, не работает ...)

Некоторые другие полезные вещи:

Некоторая информация об правилах udev

udev rules

Simlar question

1
задан 3 May 2017 в 14:54

0 ответов

Другие вопросы по тегам:

Похожие вопросы: