aboutsummaryrefslogtreecommitdiff
path: root/bin/icd
blob: 21ff806a44317287d8d7452f800eeafee4ed5eb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

OPTIONS="-option lv3:ralt_switch_multikey \
    -option terminate:ctrl_alt_bksp \
    -option ctrl:swapcaps \
    -option nbsp:level3n \
    -I${HOME}/.xkb \
    -layout icd \
    -variant icd"

SUN_USB_ID=$(lsusb | grep Sun | awk '{ print $6 }')
SUN_XINPUT_ID=$(xinput | grep ${SUN_USB_ID} | sed -e 's/.*id=\([0-9]\+\).*/\1/g')

setxkbmap ${OPTIONS} -print > ${HOME}/.xkb/keymap/icd
xkbcomp -I/home/ryan/.xkb /home/ryan/.xkb/keymap/icd $DISPLAY 2> /dev/null

if [ "x${SUN_XINPUT_ID}" != "x" ]; then
    setxkbmap \
        -I${HOME}/.xkb \
        -keycodes "rak" \
        -device ${SUN_XINPUT_ID} \
        -geometry "sun(type6)" \
        -option "myswap(switch_lalt_lsuper)" \
        ${OPTIONS} \
        -print > ${HOME}/.xkb/keymap/icd.sun
#    awk '{ \
#        if (/symbols/) { \
#            sub(/\)\"/, ")+myswap(switch_lalt_lsuper)\""); print \
#        } else { \
#            print \
#        } \
#    }' ${HOME}/.xkb/keymap/icd.sun2 > ${HOME}/.xkb/keymap/icd.sun
    xkbcomp -i ${SUN_USB_ID} -I${HOME}/.xkb \
        ${HOME}/.xkb/keymap/icd.sun ${DISPLAY} # 2> /dev/null
        #xkbcomp -i ${SUN_USB_ID} -I${HOME}/.xkb \
        #    ${HOME}/.xkb/symbols/myswap ${DISPLAY} # 2> /dev/null
fi

echo icd > /home/ryan/.xmonad/layout