Ubuntu Pastebin

Paste from fff at Mon, 12 Dec 2016 11:08:13 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
------
/etc/udev/rules.d/10-local.rules
------

ACTION=="add", SUBSYSTEM=="input", KERNEL=="mouse[0-9]", ENV{DISPLAY}=":0",ENV{XAUTHORITY}="/home/user/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/bin/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+="/bin/touchpad_switcher.sh true"


------
/bin/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
Download as text