Mailing List Archive

Software emulation of angled arrow keys on Lenovo Thinkpad?
The Thinkpad has vertical and horizontal arrow keys. But it does not
have arrow keys corresponding to 7, 9, 1, and 3 on a regular keyboard.
Yes, I know how to "enable numeric keypad" on a Thinkpad. While that
does emulate numbers, it does not emulate the arrows. I happen to need
the angled arrows. Is there a way to find out the keycodes, and send
them? Plan B is to buy a hardware keypad off Amazon.

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
On 2022.08.24 08:16, Walter Dnes wrote:
> The Thinkpad has vertical and horizontal arrow keys. But it does
> not
> have arrow keys corresponding to 7, 9, 1, and 3 on a regular keyboard.
> Yes, I know how to "enable numeric keypad" on a Thinkpad. While that
> does emulate numbers, it does not emulate the arrows. I happen to
> need
> the angled arrows. Is there a way to find out the keycodes, and send
> them? Plan B is to buy a hardware keypad off Amazon.
>
> --
> Walter Dnes <waltdnes@waltdnes.org>
> I don't run "desktop environments"; I run useful applications
On my keyboard, those corner keys on the keypad are End, PgDn, PgUp,
and NumLock, all of which have their own keys elsewhere on the
keyboard.. When you say angled arrow keys, do you mean that literally,
or are you just talking about the corner keys of the keypad? I don't
recall ever seeng a literal angled arrow on a keyboard.

Jack
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
On Wed, Aug 24, 2022 at 01:07:52PM -0400, Jack wrote

> On my keyboard, those corner keys on the keypad are End, PgDn, PgUp,
> and NumLock, all of which have their own keys elsewhere on the
> keyboard.. When you say angled arrow keys, do you mean that literally,
> or are you just talking about the corner keys of the keypad? I don't
> recall ever seeng a literal angled arrow on a keyboard.

No literal arrows. But an old OS/2 game I enjoy, treats the numeric
keypads as...
{HOME} ==> move up and to the left
{PgUp} ==> move up and to the right
{END} ==> move down and to the left
{PgDn} ==> move down and to the right

I have tried {HOME}, {PgUp}, {END}, {PgDn} on the Thinkpad but the
game did not respond. If I attach a big clunky regular USB keyboard, it
works as expected.

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
On 2022.08.24 17:21, Walter Dnes wrote:
> On Wed, Aug 24, 2022 at 01:07:52PM -0400, Jack wrote
>
> > On my keyboard, those corner keys on the keypad are End, PgDn, PgUp,
> > and NumLock, all of which have their own keys elsewhere on the
> > keyboard.. When you say angled arrow keys, do you mean that
> literally,
> > or are you just talking about the corner keys of the keypad? I
> don't
> > recall ever seeng a literal angled arrow on a keyboard.
>
> No literal arrows. But an old OS/2 game I enjoy, treats the numeric
> keypads as...
> {HOME} ==> move up and to the left
> {PgUp} ==> move up and to the right
> {END} ==> move down and to the left
> {PgDn} ==> move down and to the right
>
> I have tried {HOME}, {PgUp}, {END}, {PgDn} on the Thinkpad but the
> game did not respond. If I attach a big clunky regular USB keyboard,
> it
> works as expected.

Ah - I expect the game is interpreting keycodes fairly directly. You
can use xev (or similar) to find what the various keys are currently
producing, and there must be some (Xorg related) program to translate
them to whatever the program is expecting - perhaps determined by using
xev with a "proper" keyboard. Wasn't there an early rogue-like game
that used some of the main keys in the same way, but without invoking
the numeric keypad?
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
On Wed, Aug 24, 2022 at 05:58:28PM -0400, Jack wrote

> Ah - I expect the game is interpreting keycodes fairly directly. You
> can use xev (or similar) to find what the various keys are currently
> producing, and there must be some (Xorg related) program to translate
> them to whatever the program is expecting - perhaps determined by using
> xev with a "proper" keyboard.

1..9 on a real keyboard numeric keypad. The "XLookupString" line
tells you which key is pressed. I think the "keycode" entry is what is
being acted on by the game. Google seems to indicate that setxkbmap is
what I need, Once I emerge it, then what?

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031605618, (-448,387), root:(368,623),
state 0x10, keycode 87 (keysym 0xffb1, KP_1), same_screen YES,
XLookupString gives 1 bytes: (31) "1"
XmbLookupString gives 1 bytes: (31) "1"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031605778, (-448,387), root:(368,623),
state 0x10, keycode 87 (keysym 0xffb1, KP_1), same_screen YES,
XLookupString gives 1 bytes: (31) "1"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031650802, (105,320), root:(921,556),
state 0x10, keycode 88 (keysym 0xffb2, KP_2), same_screen YES,
XLookupString gives 1 bytes: (32) "2"
XmbLookupString gives 1 bytes: (32) "2"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031650962, (105,320), root:(921,556),
state 0x10, keycode 88 (keysym 0xffb2, KP_2), same_screen YES,
XLookupString gives 1 bytes: (32) "2"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031840786, (76,301), root:(892,537),
state 0x10, keycode 89 (keysym 0xffb3, KP_3), same_screen YES,
XLookupString gives 1 bytes: (33) "3"
XmbLookupString gives 1 bytes: (33) "3"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031840946, (76,301), root:(892,537),
state 0x10, keycode 89 (keysym 0xffb3, KP_3), same_screen YES,
XLookupString gives 1 bytes: (33) "3"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031846434, (76,301), root:(892,537),
state 0x10, keycode 83 (keysym 0xffb4, KP_4), same_screen YES,
XLookupString gives 1 bytes: (34) "4"
XmbLookupString gives 1 bytes: (34) "4"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031846594, (76,301), root:(892,537),
state 0x10, keycode 83 (keysym 0xffb4, KP_4), same_screen YES,
XLookupString gives 1 bytes: (34) "4"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031849730, (76,301), root:(892,537),
state 0x10, keycode 84 (keysym 0xffb5, KP_5), same_screen YES,
XLookupString gives 1 bytes: (35) "5"
XmbLookupString gives 1 bytes: (35) "5"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031849874, (76,301), root:(892,537),
state 0x10, keycode 84 (keysym 0xffb5, KP_5), same_screen YES,
XLookupString gives 1 bytes: (35) "5"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031852754, (76,301), root:(892,537),
state 0x10, keycode 85 (keysym 0xffb6, KP_6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XmbLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031852914, (76,301), root:(892,537),
state 0x10, keycode 85 (keysym 0xffb6, KP_6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031960290, (74,286), root:(890,522),
state 0x10, keycode 79 (keysym 0xffb7, KP_7), same_screen YES,
XLookupString gives 1 bytes: (37) "7"
XmbLookupString gives 1 bytes: (37) "7"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031960418, (74,286), root:(890,522),
state 0x10, keycode 79 (keysym 0xffb7, KP_7), same_screen YES,
XLookupString gives 1 bytes: (37) "7"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031963218, (74,286), root:(890,522),
state 0x10, keycode 80 (keysym 0xffb8, KP_8), same_screen YES,
XLookupString gives 1 bytes: (38) "8"
XmbLookupString gives 1 bytes: (38) "8"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031963378, (74,286), root:(890,522),
state 0x10, keycode 80 (keysym 0xffb8, KP_8), same_screen YES,
XLookupString gives 1 bytes: (38) "8"
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031966946, (74,286), root:(890,522),
state 0x10, keycode 81 (keysym 0xffb9, KP_9), same_screen YES,
XLookupString gives 1 bytes: (39) "9"
XmbLookupString gives 1 bytes: (39) "9"
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x1000001,
root 0x76b, subw 0x0, time 2031967074, (74,286), root:(890,522),
state 0x10, keycode 81 (keysym 0xffb9, KP_9), same_screen YES,
XLookupString gives 1 bytes: (39) "9"
XFilterEvent returns: False


--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
That's on a real numeric keypad. Meanwhile on the Lenovo Thinkpad

left shift

KeyPress event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25019825, (528,-50), root:(532,488),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25019913, (528,-50), root:(532,488),
state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

exit

KeyPress event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25211416, (708,53), root:(712,591),
state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25211553, (708,53), root:(712,591),
state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

pgdn

KeyPress event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25338798, (677,2), root:(681,540),
state 0x0, keycode 117 (keysym 0xff56, Next), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25338934, (677,2), root:(681,540),
state 0x0, keycode 117 (keysym 0xff56, Next), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

home

KeyPress event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25427458, (880,-8), root:(884,530),
state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25427562, (880,-8), root:(884,530),
state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

pgup

KeyPress event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25478798, (767,108), root:(771,646),
state 0x0, keycode 112 (keysym 0xff55, Prior), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0xe00001,
root 0x256, subw 0x0, time 25478901, (767,108), root:(771,646),
state 0x0, keycode 112 (keysym 0xff55, Prior), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

###################################################################

Is it possible to map {LEFT-SHIFT} plus End, PgDn, Home, PgUp to "real
keypad" 1, 3, 7, 9 respectively? If the {LEFT-SHIFT} is not being held
down, then the End, PgDn, Home, PgUp would have their regular meanings.
To be more specific, while "keycode 50 (keysym 0xffe1, Shift_L)" is in
effect (i.e. {Left}{SHIFT} is being held down)...

{END} (aka down left) maps to "keycode 87 (keysym 0xffb1, KP_1)"

{PgDn} (aka down right) maps to "keycode 89 (keysym 0xffb3, KP_3)"

{HOME} (aka up left) maps to "keycode 79 (keysym 0xffb7, KP_7)"

{PgUp} (aka up right) maps to "keycode 81 (keysym 0xffb9, KP_9)"

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
On 2022.08.25 20:16, Walter Dnes wrote:
> On Wed, Aug 24, 2022 at 05:58:28PM -0400, Jack wrote
>
> > Ah - I expect the game is interpreting keycodes fairly directly.
> You
> > can use xev (or similar) to find what the various keys are currently
> > producing, and there must be some (Xorg related) program to
> translate
> > them to whatever the program is expecting - perhaps determined by
> using
> > xev with a "proper" keyboard.
>
> 1..9 on a real keyboard numeric keypad. The "XLookupString" line
> tells you which key is pressed. I think the "keycode" entry is what
> is
> being acted on by the game. Google seems to indicate that setxkbmap
> is
> what I need, Once I emerge it, then what?
>
> KeyPress event, serial 38, synthetic NO, window 0x1000001,
> root 0x76b, subw 0x0, time 2031605618, (-448,387), root:(368,623),
> state 0x10, keycode 87 (keysym 0xffb1, KP_1), same_screen YES,
> XLookupString gives 1 bytes: (31) "1"
> XmbLookupString gives 1 bytes: (31) "1"
> XFilterEvent returns: False

The XLookupString looks like the ascii for the character/digit. The
keycode does seem like what you want. Googling "linux remap keycodes"
should be a good start, but it looks like xmodmap is proabably what you
want to use. However, you also need to know the keycode of the key you
want to remap. Essentially, you need to remap whatever keycode your
current keyboard is generating to that which the game expects for that
key. I'm not at all familiar with either program beyond browsing a few
Google results, but perhaps setxkbmap is used for a major remap of
most/all keys on a keyboard and xmodmap can be used for single or a
small number of keys.
Re: Software emulation of angled arrow keys on Lenovo Thinkpad? [ In reply to ]
At this point, I'm doing no better than guessing.  I'd suggest trying
things.  I'd map the keycode of the keypress you want to use to the
keycode of what the program seems to expect for that key.

On 8/27/22 03:30, Walter Dnes wrote:
> That's on a real numeric keypad. Meanwhile on the Lenovo Thinkpad
>
> left shift
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25019825, (528,-50), root:(532,488),
> state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25019913, (528,-50), root:(532,488),
> state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> exit
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25211416, (708,53), root:(712,591),
> state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25211553, (708,53), root:(712,591),
> state 0x0, keycode 115 (keysym 0xff57, End), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> pgdn
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25338798, (677,2), root:(681,540),
> state 0x0, keycode 117 (keysym 0xff56, Next), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25338934, (677,2), root:(681,540),
> state 0x0, keycode 117 (keysym 0xff56, Next), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> home
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25427458, (880,-8), root:(884,530),
> state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25427562, (880,-8), root:(884,530),
> state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> pgup
>
> KeyPress event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25478798, (767,108), root:(771,646),
> state 0x0, keycode 112 (keysym 0xff55, Prior), same_screen YES,
> XLookupString gives 0 bytes:
> XmbLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> KeyRelease event, serial 38, synthetic NO, window 0xe00001,
> root 0x256, subw 0x0, time 25478901, (767,108), root:(771,646),
> state 0x0, keycode 112 (keysym 0xff55, Prior), same_screen YES,
> XLookupString gives 0 bytes:
> XFilterEvent returns: False
>
> ###################################################################
>
> Is it possible to map {LEFT-SHIFT} plus End, PgDn, Home, PgUp to "real
> keypad" 1, 3, 7, 9 respectively? If the {LEFT-SHIFT} is not being held
> down, then the End, PgDn, Home, PgUp would have their regular meanings.
> To be more specific, while "keycode 50 (keysym 0xffe1, Shift_L)" is in
> effect (i.e. {Left}{SHIFT} is being held down)...
I think the whole point of the mapping is to change the meaning of the
keypress events to be recognized as something else.  You should be able
to map the press with or without the LEFT-SHIFT.  From the little I
understand, xmodmap can be easily appied/reversed - you may just need
two files, one to make the changes, one to reverse them. Personally, I
would just start trying stuff to see what works.
>
> {END} (aka down left) maps to "keycode 87 (keysym 0xffb1, KP_1)"
>
> {PgDn} (aka down right) maps to "keycode 89 (keysym 0xffb3, KP_3)"
>
> {HOME} (aka up left) maps to "keycode 79 (keysym 0xffb7, KP_7)"
>
> {PgUp} (aka up right) maps to "keycode 81 (keysym 0xffb9, KP_9)"
>