Created
June 17, 2015 07:45
-
-
Save jsarenik/64d9ff0104939cd73948 to your computer and use it in GitHub Desktop.
X Window script to set up keyboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
setxkbmap ${1:-'dvorak'} | |
setxkbmap -option "" | |
xmodmap - <<EOF | |
! for help, see $ xmodmap -grammar | |
!in /etc/X11/xorg.conf.d/20-keyboard.conf | |
! or by running setxkbmap -option "ctrl:nocaps" | |
remove Lock = Caps_Lock | |
keysym Caps_Lock = Control_L | |
add Control = Control_L | |
! MacBook keys - Alt instead of Command, Right Command = Compose | |
clear Mod4 | |
clear Mod1 | |
keycode 133 = Super_R | |
!keycode 134 = Super_L | |
keysym Super_R = Multi_key | |
add Mod1 = Alt_L Super_L | |
! Normal right Alt Compose | |
keysym Alt_R = Multi_key | |
! Natural two-finger scrolling | |
pointer = 1 2 3 5 4 7 6 8 9 10 11 12 13 | |
!pointer = 1 2 3 5 4 7 6 8 9 10 11 12 | |
EOF | |
#setxkbmap -option "ctrl:nocaps" | |
#setxkbmap -option "compose:ralt" | |
#setxkbmap -option "compose:rctrl" | |
#setxkbmap -option "grp:alts_toggle" | |
#setxkbmap -option "grp_led:scroll" | |
setxkbmap -query | |
## Make sure caps-lock is turned off | |
# ... | |
# Keyboard Control: | |
# auto repeat: on key click percent: 0 LED mask: 00000000 | |
# XKB indicators: | |
# 00: Caps Lock: off 01: Num Lock: off 02: Scroll Lock: off | |
# 03: Compose: off 04: Kana: off 05: Sleep: off | |
# ... | |
CAPSTATE=`xset -q | grep -Eo "[0-9]+: Caps Lock:\s+\S+" | awk '{print $4}'` | |
test "$CAPSTATE" = "on" && xdotool key Caps_Lock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment