add mappings for media keys

This commit is contained in:
sasha0552
2024-04-03 14:11:11 +00:00
committed by GitHub
parent e73f26c7c1
commit c07d6e793e
4 changed files with 162 additions and 22 deletions
+24 -7
View File
@@ -1,11 +1,29 @@
#!/bin/sh
if ! command -v setxkbmap >/dev/null
then
echo "error, setxkbmap not found"
exit 1
# Run the keymap extraction in a clean X session
if [ "$1" != _IN_XVFB_SESSION_ ]; then
# All commands available?
ok=1
for cmd in setxkbmap xvfb-run xauth; do
if ! command -v $cmd >/dev/null
then
echo "Error. $cmd not found" >&2
ok=
fi
done
if [ -z "$ok" ]; then
exit 1
fi
xvfb-run --auto-servernum --server-args="-noreset" $0 _IN_XVFB_SESSION_
exit $?
fi
OLD_SETTINGS=$(setxkbmap -query -verbose 4 | sed "s/^\([a-z]\+\):\s*\(.*\)$/-\1 \2/;s/^-options/-option \"\" -option/;s/,/ -option /g" | xargs -d \\n)
# Use evdev rules for these mappings
setxkbmap -rules evdev
# English - US 'en-us' 0x00000409
setxkbmap -model pc104 -layout us
./xrdp-genkeymap ../instfiles/km-00000409.ini
@@ -15,7 +33,6 @@ setxkbmap -model pc104 -layout dvorak
./xrdp-genkeymap ../instfiles/km-00010409.ini
# English - US 'dvp' 0x19360409
OLD_SETTINGS=$(setxkbmap -query -verbose 4 | sed "s/^\([a-z]\+\):\s*\(.*\)$/-\1 \2/;s/^-options/-option \"\" -option/;s/,/ -option /g" | xargs -d \\n)
setxkbmap -rules xfree86 -model pc105 -layout us -variant dvp -option "" -option compose:102 -option caps:shift -option numpad:sg -option numpad:shift3 -option keypad:hex -option keypad:atm -option kpdl:semi -option lv3:ralt_alt
./xrdp-genkeymap ../instfiles/km-19360409.ini
setxkbmap ${OLD_SETTINGS}
@@ -52,5 +69,5 @@ setxkbmap -model pc104 -layout se
setxkbmap -model pc104 -layout pt
./xrdp-genkeymap ../instfiles/km-00000816.ini
# set back to en-us
setxkbmap -model pc104 -layout us
# set back to entry settings
setxkbmap ${OLD_SETTINGS}
+123 -5
View File
@@ -26,7 +26,7 @@
#include <config_ac.h>
#endif
int xfree86_to_evdev[137 - 8 + 1] =
int xfree86_to_evdev[255 - 8 + 1] =
{
/* MDSW */ 203,
/* ESC */ 9,
@@ -141,9 +141,9 @@ int xfree86_to_evdev[137 - 8 + 1] =
/* FK13 */ 191,
/* FK14 */ 192,
/* FK15 */ 193,
/* FK16 */ 194,
/* FK17 */ 195,
/* KPDC */ 0,
/* XF86AudioMute */ 121,
/* XF86AudioLowerVolume */ 122,
/* XF86AudioRaiseVolume */ 123,
/* LVL3 */ 92,
/* ALT */ 204,
/* KPEQ */ 125,
@@ -156,6 +156,124 @@ int xfree86_to_evdev[137 - 8 + 1] =
/* AE13 */ 132,
/* I06 */ 0,
/* I07 */ 0,
/* Cancel */ 136,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
/* XF86Launch1 */ 156,
/* XF86Launch2 */ 157,
0,
0,
0,
0,
0,
/* XF86Mail */ 163,
/* XF86Favorites */ 164,
0,
/* XF86Back */ 166,
/* XF86Forward */ 167,
0,
0,
0,
/* XF86AudioNext */ 171,
/* XF86AudioPlay */ 172,
/* XF86AudioPrev */ 173,
/* XF86AudioStop */ 174,
0,
0,
0,
0,
0,
/* XF86HomePage */ 180,
/* XF86Reload */ 181,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
/* XF86Search */ 225,
0,
0,
0,
0,
0,
0,
0,
0,
/* XF86AudioMedia */ 234,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
};
+5 -1
View File
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
fprintf(outf, "[%s]\n", sections[idx]);
e.state = states[idx];
for (i = 8; i < 137; i++) /* Keycodes */
for (i = 8; i < 256; i++) /* Keycodes */
{
if (is_evdev)
{
@@ -148,6 +148,10 @@ int main(int argc, char **argv)
e.keycode = i;
}
nbytes = XLookupString(&e, text, 255, &ks, NULL);
if (ks == NoSymbol)
{
continue;
}
text[nbytes] = 0;
char_count = mbstowcs(wtext, text, 255);
unicode = 0;