Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Setup Lenovo USB keyboard with trackpoint
- # Systemd users:
- # /etc/udev/rules.d/99-lenovo-kbd.rules:
- # ACTION=="add", ATTR{idVendor}=="17ef", ATTR{idProduct}=="6047", TAG+="systemd", ENV{SYSTEMD_WANTS}="udev-lenovo-kbd-attach.service"
- # /etc/systemd/system/udev-lenovo-kbd-attach.service:
- # [Service]
- # Type=oneshot
- # ExecStart=/usr/local/bin/lenovo_kbd.sh
- # User=youruser
- #
- sleep 1
- export DISPLAY=":0.0"
- export HOME="/home/filip"
- export XAUTHORITY="$HOME/.Xauthority"
- log_info() {
- cat - | logger -p user.info -t `basename $0`
- }
- log_error() {
- cat - | logger -p user.error -t `basename $0`
- }
- device_id=$(xinput -list | grep -i 'Lenovo ThinkPad Compact USB Keyboard with TrackPoint' | grep -o id='[0-9].' | grep -o '[0-9].' | head -1)
- if [ -z $device_id ]; then
- echo "Device ID not found"|log_error
- exit 1
- fi
- xinput set-prop $device_id "Device Accel Constant Deceleration" 0.4 2>&1|log_info
- xinput set-int-prop $device_id "Evdev Wheel Emulation" 8 1 2>&1|log_info
- xinput set-int-prop $device_id "Evdev Wheel Emulation Button" 8 2 2>&1|log_info
- xinput set-int-prop $device_id "Evdev Wheel Emulation Axes" 8 6 7 4 5 2>&1|log_info
- xset r rate 200 20 2>&1|log_info
- notify-send "External keyboard plugged in" -i gtk-dialog-info -u normal -i keyboard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement