summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xar/.local/bin/remaps48
1 files changed, 27 insertions, 21 deletions
diff --git a/ar/.local/bin/remaps b/ar/.local/bin/remaps
index c4d9a30..fb70142 100755
--- a/ar/.local/bin/remaps
+++ b/ar/.local/bin/remaps
@@ -5,52 +5,58 @@
xset r rate 200 50
# Map the caps lock key to control, and map the menu key to right super.
xinput list | grep 'id=' | while read -r line; do
- id=$(echo "$line" | grep -i 'keyboard.*id.*keyboard' | sed 's/.*id=\([0-9]\+\).*/\1/')
- [ -z "$id" ] || {
+ keyboard=$(echo "$line" | grep -i 'keyboard.*id.*keyboard' | sed 's/.*id=\([0-9]\+\).*/\1/')
+ mouse=$(echo "$line" | grep -i '.*id.*pointer' | sed 's/.*id=\([0-9]\+\).*/\1/')
+ [ -z "$keyboard" ] || {
case "$(echo "$line" | grep -oE '.*id=' | sed 's/ id=.*//')" in
*"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav"*)
- setxkbmap -device "$id" -option
- setxkbmap -device "$id" -option caps:ctrl_modifier,ctrl:swap_lwin_lctl
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option caps:ctrl_modifier,ctrl:swap_lwin_lctl
;;
*"Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint"* | *"AT Translated Set 2 keyboard"*)
- setxkbmap -device "$id" -option
- setxkbmap -device "$id" -option caps:ctrl_modifier,altwin:menu_win,altwin:swap_lalt_lwin
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option caps:ctrl_modifier,altwin:menu_win,altwin:swap_lalt_lwin
;;
*"Magic keyboard"*)
- setxkbmap -device "$id" -option
- setxkbmap -device "$id" -option caps:ctrl_modifier
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option caps:ctrl_modifier
;;
*"HHKB"*)
- setxkbmap -device "$id" -option
- setxkbmap -device "$id" -option altwin:menu_win
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option altwin:menu_win
+ ;;
+ *"Glove80"*)
+ setxkbmap -device "$keyboard" -option
;;
*)
- setxkbmap -device "$id" -option
- setxkbmap -device "$id" -option caps:ctrl_modifier,altwin:menu_win
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option caps:ctrl_modifier,altwin:menu_win
;;
esac
}
- id=$(echo "$line" | grep -i '.*id.*pointer' | sed 's/.*id=\([0-9]\+\).*/\1/')
- [ -z "$id" ] || {
+ [ -z "$mouse" ] || {
case "$(echo "$line" | grep -oE '.*id=' | sed 's/ id=.*//')" in
*"Apple Inc. Magic Trackpad"*)
- xinput set-prop "$id" "libinput Tapping Enabled" 0
+ xinput set-prop "$mouse" "libinput Tapping Enabled" 0
;;
*"SynPS/2 Synaptics TouchPad"*)
- xinput set-prop "$id" "libinput Tapping Enabled" 0
+ xinput set-prop "$mouse" "libinput Tapping Enabled" 0
;;
*"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav Mouse"*)
- [ -z "$1" ] && xinput set-prop "$id" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$id" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
- xinput set-prop "$id" "libinput Scroll Method Enabled" 0, 0, 1
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ xinput set-prop "$mouse" "libinput Scroll Method Enabled" 0, 0, 1
;;
*"Logitech USB Receiver"*)
- [ -z "$1" ] && xinput set-prop "$id" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$id" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
;;
*"TPPS/2 IBM TrackPoint"*)
- [ -z "$1" ] && xinput set-prop "$id" "Coordinate Transformation Matrix" 1, 0, 0, 0, 1, 0, 0, 0, 1 || xinput set-prop "$id" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 1, 0, 0, 0, 1, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
;;
*"Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint"*)
- [ -z "$1" ] && xinput set-prop "$id" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$id" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ ;;
+ *"Glove80 Mouse"*)
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 3, 0, 0, 0, 3, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
;;
esac
}