7

My system is a Windows OS. However, every time I am using Linux on Virtualbox, as soon as I switch from VirtualBox to another (host machine's) windows program, my NumLock is off.

I could have NumLock on in Linux (VirtualBox), but it turns off when switching back to any Windows program. Is there a way to keep NumLock on regardless?

2 Answers2

6

NumLock problems have plagued VirtualBox for more than a decade. Periodically they were fixed, only to reappear again in the next release. It seems that it's quite complicated to keep account of this state when focus and NumLock state may change by a simple movement of the cursor.

The article VirtualBox numlock weirdness by Martin van Beurden from 2015 claims to have found this solution:

After upgrading to VirtualBox 5 on Windows every time I started, focused or unfocused a virtual machine my numlock status would toggle. If you're having the same problem here is how to fix it:

VBoxManage setextradata "<machine-name>" GUI/HidLedsSync "0"

This will disable keyboard indicators (HID LEDs) synchronization. This setting it supposed to be disabled by default but for some reason it was not on my installation. VBoxManage is located where you installed virtualbox, usually C:\Program Files\Oracle\VirtualBox.

If you have a lot of virtual machines you can process them all by running the following commands:

  1. Open a command prompt

  2. Add virtualbox to you path:

    set path=%path%;C:\Program Files\Oracle\VirtualBox
    
  3. Go to the directory where you're virtual machines are located, commands below are for a default install:

    %HOMEDRIVE%
    cd "%HOMEPATH%\VirtualBox VMs"
    
  4. Update the setting for all machines in the directory

    for /f "tokens=*" %G in ('dir /b /a:d ".\*"') do (VBoxManage setextradata "%G" GUI/HidLedsSync "0")
    

Hooray, no more numlock weirdness.

I'm not using VirtualBox, so cannot test if this 2015 fix still works.

harrymc
  • 498,455
0

The free software NumLocker can keep your NumLock always on (or always off).

If you need more control, you could consider the PRO (paid) version of TrayStatus, which according to the website allows you

to automatically enable or disable Caps/Num/Scroll Lock when specific applications or windows are focused.

Note: I'm not associated in any way with these softwares.

1NN
  • 10,044