Is there a way to detect numbers entered from Number Pad vs. numbers entered from top line of the keyboard? I’ve seen a few applications where they are treated differently but I don’t know how to detect the difference.
I can’t tell you how to access this within LibreOffice, but the keyboard-events usually generate different scan-codes for the numeric-keypad and the top-line of the keyboard (and there are usually 2 events, as the key is pressed and released).
Keyboard driver (by the operating-system) is usually adding the character-code, according to the current setting for the keyboard layout.
What do you want to do?
- bind a macro to events of the numeric keypad
- modify input before being processed by macro
- something else
Depending on your goal different approaches may be needed, and your tag “writer” don’t tell much…
test with ‘xev’ on debian10 for example ‘1’ on numpad and ‘1’ on keybord:
KeyPress event, serial 45, synthetic NO, window 0x2200001, root 0x37a, subw 0x0, time 785404650, (94,691), root:(96,751), state 0x10, keycode 87 (keysym 0xffb1, KP_1), same_screen YES, #↑↑↑keycode 87 !!! from numpad XLookupString gives 1 bytes: (31) "1" XmbLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False KeyPress event, serial 48, synthetic NO, window 0x2200001, root 0x37a, subw 0x0, time 785422781, (94,691), root:(96,751), state 0x10, keycode 10 (keysym 0x31, 1), same_screen YES, #↑↑↑keycode 10 !! from keyboard XLookupString gives 1 bytes: (31) "1" XmbLookupString gives 1 bytes: (31) "1" XFilterEvent returns: False
Thanks. Yes, I’d like to distinguish the two, e.g. to invoke macro. I don’t think there’s an easy way to do it from within L/O without invoking an external routine.