Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Setup Lenovo USB keyboard with trackpoint
  4. # Systemd users:
  5. # /etc/udev/rules.d/99-lenovo-kbd.rules:
  6. # ACTION=="add", ATTR{idVendor}=="17ef", ATTR{idProduct}=="6047", TAG+="systemd", ENV{SYSTEMD_WANTS}="udev-lenovo-kbd-attach.service"
  7. # /etc/systemd/system/udev-lenovo-kbd-attach.service:
  8. # [Service]
  9. # Type=oneshot
  10. # ExecStart=/usr/local/bin/lenovo_kbd.sh
  11. # User=youruser
  12. #
  13.  
  14. sleep 1
  15.  
  16. export DISPLAY=":0.0"
  17. export HOME="/home/filip"
  18. export XAUTHORITY="$HOME/.Xauthority"
  19.  
  20. log_info() {
  21. cat - | logger -p user.info -t `basename $0`
  22. }
  23.  
  24. log_error() {
  25. cat - | logger -p user.error -t `basename $0`
  26. }
  27.  
  28. device_id=$(xinput -list | grep -i 'Lenovo ThinkPad Compact USB Keyboard with TrackPoint' | grep -o id='[0-9].' | grep -o '[0-9].' | head -1)
  29.  
  30. if [ -z $device_id ]; then
  31. echo "Device ID not found"|log_error
  32. exit 1
  33. fi
  34.  
  35. xinput set-prop $device_id "Device Accel Constant Deceleration" 0.4 2>&1|log_info
  36. xinput set-int-prop $device_id "Evdev Wheel Emulation" 8 1 2>&1|log_info
  37. xinput set-int-prop $device_id "Evdev Wheel Emulation Button" 8 2 2>&1|log_info
  38. xinput set-int-prop $device_id "Evdev Wheel Emulation Axes" 8 6 7 4 5 2>&1|log_info
  39. xset r rate 200 20 2>&1|log_info
  40.  
  41. notify-send "External keyboard plugged in" -i gtk-dialog-info -u normal -i keyboard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement