Let's start with some explanation of what is happening and why your idea doesn't work. First, take a look at the modifier map:
$ xmodmap
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
As you can see, Num_Lock
is mod2
here. When it is on, all keypress events come with mod2
bit on.
If you disable it like this:
$ xmodmap -e "keycode 77 = NoSymbol"
$ xmodmap
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 BadKey (0x4d)
mod3
mod4 Super_L (0x85), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Note that mod2
is now associated with BadKey
, and this seems to confuse Xorg a lot. In fact, most of modifier map changes seem to break X11 for me.
Right now, I can't find a good solution that involves playing with modifier map. But I have another idea: you can map all keypad keys to work the same with num lock both on and off. That is:
xmodmap -e "keysym KP_Up = KP_8"
xmodmap -e "keysym KP_Left = KP_4"
# ...
etc. Once you do that, the state of num lock will no longer matter.
You can even remove the modifier afterwards to turn the LED switching off:
xmodmap -e "remove mod2 = Num_Lock"
The VM's BIOS is where you need to change this behavior. Unfortunately VMware Player does not allow you to choose to boot into the BIOS via the GUI. See this accepted answer to a different question for a method to do so by modifying the .vmx file.
Once you're in, on the Main tab, select Keyboard Features, then set NumLock to either On or Auto (presumably follows host machine's NumLock state).
Best Answer
I use CapShift and it's free:
https://www.donationcoder.com/Software/Skrommel/index.html#CAPshift
"CAPshift extends the Caps Lock key by slowing it down...
The Advantage is: You don't lose the ability to change NumLock if you really need to.