Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 58 lines (50 sloc) 1.89 KB
#!/bin/bash
usage() {
bin=$(basename $0)
echo >&2 "Usage: $bin [--nomap]"
echo >&2
echo >&2 "Note: --nomap disables xmodmap and"
echo >&2 " setxkbmap, which are usually slow for some reason."
exit ${1:-0}
}
[[ "$#" -gt 1 || "$1" = -h || "$1" = --help ]] && usage
[[ -z "$1" || "$1" = --nomap ]] || usage
set -o pipefail
err=0
[[ "$1" = --nomap ]] || {
node=$(uname -n)
if [[ "$node" = sacrilege ]]
then
# There's some weird interaction between "setxkbmap -model ..." and xmodmap
xmodmap ~/.xmodmaprc || err=1
setxkbmap -model acer_laptop -rules evdev\
-layout 'us,ru' -option 'grp:switch,grp:caps_toggle,grp_led:caps' || err=1
# Running all "keycode ..." rules somehow breaks "-model acer_laptop" keys, idk
xmodmap -e 'keycode 108 = Alt_L'
else
setxkbmap -rules evdev\
-layout 'us,ru' -option 'grp:switch,grp:caps_toggle,grp_led:caps' || err=1
xmodmap ~/.xmodmaprc || err=1
fi
}
xset r rate 250 40 || err=1
# Not sure which it's supposed to apply to, gotta check
dev='PS/2 Logitech Wheel Mouse'
xinput list "$dev" &>/dev/null && {
xinput set-prop "$dev" --type=float 257 9999999 || err=1
xinput set-prop "$dev" --type=float 256 50 || err=1
} ||:
# Razer E-BLUE mouse
# Middle button gets remapped to "8", so that xbindkeys script can proxy it to "2" with debouncing
# One side button is used exclusively for wakeups, so is disabled, other one is for xmodmap to bind
dev=$( xinput list |
awk 'match($0,/\<2.4G 2.4G Wireless Device\s+id=([0-9]+)\s+\[slave\s+pointer\>/,a) {print a[1]}' )
[[ -n "$dev" ]] && xinput list "$dev" &>/dev/null && {
xinput set-button-map "$dev" 1 8 3 4 5 6 7 0 9 10 11 12 13 || err=1
} ||:
# Synaptics settings, in case something (e.g. WM) messes these up
synclient -l &>/dev/null && {
awk 'match($2,/"/) && NF==3 && $1=="Option" {gsub(/"/,"",$2); gsub(/"/,"",$3); print $2 "=" $3}'\
/usr/share/X11/xorg.conf.d/*-synaptics.conf | xargs synclient || err=1
}
exit "$err"