stop some x: keys simulating shift

This commit is contained in:
John Gebbie 2023-01-26 12:47:10 +00:00
parent c828f2d8ed
commit 04227e1d0e
2 changed files with 10 additions and 28 deletions

18
keys.go
View file

@ -408,7 +408,6 @@ var xKeysNormal = map[string]int{
"kp_insert": uinput.KeyKp0,
"kp_delete": uinput.KeyKpdot,
"iso_level3_shift": uinput.KeyZenkakuhankaku,
"less": uinput.Key102Nd,
"f11": uinput.KeyF11,
"f12": uinput.KeyF12,
"katakana": uinput.KeyKatakana,
@ -564,33 +563,16 @@ var xKeysShifted = map[string]int{
"less": uinput.KeyComma,
"greater": uinput.KeyDot,
"question": uinput.KeySlash,
"kp_multiply": uinput.KeyKpasterisk,
"f1": uinput.KeyF1,
"f2": uinput.KeyF2,
"f3": uinput.KeyF3,
"f4": uinput.KeyF4,
"f5": uinput.KeyF5,
"f6": uinput.KeyF6,
"f7": uinput.KeyF7,
"f8": uinput.KeyF8,
"f9": uinput.KeyF9,
"f10": uinput.KeyF10,
"kp_7": uinput.KeyKp7,
"kp_8": uinput.KeyKp8,
"kp_9": uinput.KeyKp9,
"kp_subtract": uinput.KeyKpminus,
"kp_4": uinput.KeyKp4,
"kp_5": uinput.KeyKp5,
"kp_6": uinput.KeyKp6,
"kp_add": uinput.KeyKpplus,
"kp_1": uinput.KeyKp1,
"kp_2": uinput.KeyKp2,
"kp_3": uinput.KeyKp3,
"kp_0": uinput.KeyKp0,
"kp_decimal": uinput.KeyKpdot,
"f11": uinput.KeyF11,
"f12": uinput.KeyF12,
"kp_divide": uinput.KeyKpslash,
"sys_req": uinput.KeySysrq,
"break": uinput.KeyPause,
"xf86audiopause": uinput.KeyPrevioussong,

View file

@ -17,26 +17,26 @@ align() {
/\<KeyMicmute\>/ d'
}
echo 'var xKeysNormal = map[string]int{'
{
normal="$({
paste -d ' ' <(xmodmap -pke | sed '1 d; s/.*= /"/; /.*=/ d; s/ .*/":/' | sed '/^"XF86Eject"/ { N; s/.*\n// }') \
<(go doc uinput.keyesc | sed '/Key/ !d; s/^\s*/uinput./; s/ .*/,/' | align) |
# Skip really non-matching section, we echo some of them below
sed '/^"XF86Tools"/,/^"XF86AudioPreset"/ d' |
# Remove duplicate keys
sed '/^"XF86Mail":.*Email/ d; /^"Cancel":.*Stop/ d; /^"XF86Send":.*file/ d; /^"Print":.*Sysrq/ d'
sed '/^"XF86Mail":.*Email/ d; /^"Cancel":.*Stop/ d; /^"XF86Send":.*file/ d; /^"Print":.*Sysrq/ d; /Key102Nd,$/ d'
echo '"XF86WebCam": uinput.KeyCamera,'
echo '"Print": uinput.KeyPrint,'
} | sed 's/^".*"/\L&/; s/^/\t/'
echo '}'
} | sed 's/^".*"/\L&/; s/^/\t/')"
printf %s\\n "var xKeysNormal = map[string]int{
$normal
}
"
echo ''
echo 'var xKeysShifted = map[string]int{'
{
paste -d ' ' <(xmodmap -pke | sed '1 d; s/.*= /"/; /.*=/ d; s/\S* /"/; s/ .*/":/' | sed '/^"XF86Eject"/ { N; s/.*\n// }') \
<(go doc uinput.keyesc | sed '/Key/ !d; s/^\s*/uinput./; s/ .*/,/' | align) | sed '/^"NoSymbol"/ d; /^\S*_[LR]"/ d' |
# Remove backspace and duplicate keys
sed '/^"BackSpace"/ d; /^"KP_Decimal":.*Kpcomma/ d; /\<Key102Nd\>/ d'
} | sed 's/^".*"/\L&/; s/^/\t/'
<(go doc uinput.keyesc | sed '/Key/ !d; s/^\s*/uinput./; s/ .*/,/' | align) | sed '/^"NoSymbol"/ d; /^\S*_[LR]"/ d; /Key102Nd,$/ d'
} | sed 's/^".*"/\L&/; s/^/\t/' | awk 'NR == FNR {if (length($1) > 4) a[$1]; next} !($1 in a)' <(printf %s\\n "$normal") -
echo '}'