#!/bin/bash setxkbmap us -option # clean slate xkbcomp $DISPLAY out.xkb # output current keymap xkbcomp out.xkb $DISPLAY # work with xkbcomp-produced keymap xkbcomp $DISPLAY out.xkb # remove some meaningless diff patch out.xkb -o patched-repeat-yes.xkb << 'EOF' --- out.xkb 2014-05-16 17:28:18.000000000 +0300 +++ patched.xkb 2014-05-16 17:31:29.000000000 +0300 @@ -590,6 +590,16 @@ level_name[Level3]= "Alt Base"; level_name[Level4]= "Alt Number"; }; + type "CTRL+ALT_ACTUALLY" { + modifiers= Control+Alt; + map[Control]= Level2; + map[Alt]= Level3; + map[Control+Alt]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Ctrl"; + level_name[Level3]= "Alt"; + level_name[Level4]= "Ctrl+Alt"; + }; }; xkb_compatibility "complete" { @@ -1322,7 +1332,12 @@ }; key { [ Linefeed ] }; key { [ Home ] }; - key { [ Up ] }; + key { + type= "CTRL+ALT_ACTUALLY", + repeat= Yes, + symbols[Group1]= [ Up, Up, Prior, Home ], + actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=,clearMods= Alt), RedirectKey(key=,clearMods= Control+Alt) ] + }; key { [ Prior ] }; key { [ Left ] }; key { [ Right ] }; EOF # there is only one "repeat= Yes," in patched-repeat-yes.xkb # so we can safely do the following two sed calls: sed "s/repeat= Yes,/repeat= No,/" \ < patched-repeat-yes.xkb \ > patched-repeat-no.xkb sed "s/repeat= Yes,//" \ < patched-repeat-yes.xkb \ > patched-repeat-undef.xkb # now let's try various combinations echo "----" echo "xset repeat on, xkb repeat undef" xset r 111 xkbcomp patched-repeat-undef.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-undef.xkb out2.xkb echo "----" echo "xset repeat on, xkb repeat yes" xset r 111 xkbcomp patched-repeat-yes.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-yes.xkb out2.xkb echo "----" echo "xset repeat on, xkb repeat no" xset r 111 xkbcomp patched-repeat-no.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-no.xkb out2.xkb echo "----" echo "xset repeat off, xkb repeat undef" xset -r 111 xkbcomp patched-repeat-undef.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-undef.xkb out2.xkb echo "----" echo "xset repeat off, xkb repeat yes" xset -r 111 xkbcomp patched-repeat-yes.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-yes.xkb out2.xkb echo "----" echo "xset repeat off, xkb repeat no" xset -r 111 xkbcomp patched-repeat-no.xkb $DISPLAY xkbcomp $DISPLAY out2.xkb diff -u patched-repeat-no.xkb out2.xkb