Sample Header Ad - 728x90

Using the Numlock key as an equals key with XKB

2 votes
1 answer
746 views
The Numlock key sees little action in today's day and age, yet it's location in the (standard) keyboard layout is quite prominent. Since I use a lot of spreadsheets, using the keypad for data entry is very convenient, with one caveat: the equal sign is quite hard to reach, when your right hand is on the keypad. My idea was to re-map Numlock, such that it can act as both, Numlock and equals, with the former accessible through a modifier. For this purpose I decided to make my own xkb keymap, as I tried the same thing with xmodmap but I had similarly bad results. (file name is pb) default partial alphanumeric_keys xkb_symbols "basic" { name[Group1] = "PB (US intl with level 3 and level 5"; key.type[Group1] = "EIGHT_LEVEL"; include "us(altgr-intl)" // (norm) NLOCK AltGr key.type[Group1] = "FOUR_LEVEL_MIXED_KEYPAD"; key { [ KP_Equal, KP_Equal, Num_Lock, Q ] }; include "level3(ralt_switch)" include "level5(rctrl_switch)" }; Now, as you can see, I added level 3 and level 5, when I want to expand my custom layout later, but I tested withou it, and it doesn't interfere with Numlock. The behavior resulting from this is as follows when pressing the Numlock key: *(numlock is off)* * Numlock: '=' * Shift + Numlock: '=' * AltGr + Numlock: (switches Num lock on) * AltGr + Shift + Numlock: 'Q' *(I added this for testing)* This is alright, printing 'Q' when holding down AltGr and Shift was just to see if I can reach that shift level. However when Num lock is on, the behavior not satisfactory at all: *(numlock is on)* * Numlock: (switches Num lock off) * Shift + Numlock: (switches Num lock off) * AltGr + Numlock: (switches Num lock off) * AltGr + Shift + Numlock: (switches Num lock off) It seems to be impossible to make Num lock behave like a KP_Equal key, no matter what I try. Originally, I wanted pressing Numlock to print an equal sign, and when holding Shift, to operate Num Lock on and off. Since that didn't seem to be possible, I opted for ISO level 3 (AltGr), but that doesn't seem to work either. What I want is that Numlock prints an equal sign no matter if Num lock is on or off, and switch Num Lock when holding down a mod key (which one, isn't really important to me, preferably Shift or AltGr).
Asked by polemon (11921 rep)
Aug 4, 2020, 06:33 PM
Last activity: Sep 9, 2020, 11:56 PM