• How to use a VM to program mice and keyboards in Linux

    Home » Forums » AskWoody support » Linux for the Home user » Linux – all distros » How to use a VM to program mice and keyboards in Linux

    Author
    Topic
    #1986888

    Lots of mice and keyboards have all kinds of extra functions that go beyond what “normal” devices do.  Mice can have lots of extra buttons that can be programmed, and sometimes keyboards do too.  Some of them have lighting effects that can be programmed… all kinds of different things are possible.

    Sometimes this extra functionality is done in software.  A program has to be running at all times, listening, waiting for the extra mouse button to be pressed (as one example), at which time it will perform its programmed action, like simulating a keypress or starting a macro.

    That’s not the kind of device I’m discussing right here.  I’m referring to devices that have onboard memory to be able provide this extra function in hardware.  In hardware mode, no translation is needed; if you press the mouse button you’ve programmed to send F1, the mouse sends a F1 directly, like it was a keyboard.  In Linux, Windows, or if you plug it into a different machine, it’s still going to send F1 when that button is pressed.  You can usually also select other hardware profiles, so you can have multiple setups (for different games, programs, etc.).

    The software that programs the mouse can usually also work in the software mode as described above, and if so, it will be necessary to select the hardware mode.

    This works well for Linux users, since we can have our devices be just as useful as in Windows, even if the mouse software won’t run in Linux.  In hardware mode, the mouse software is only needed to program the mouse, but after that, it’s usable on its own, in any OS.

    It’s not hard to set up a VM to be able to program the mouse or keyboard.  First, you’ll need Windows running as a guest in a VM, using whatever software you want to use.  There are many guides out there about setting up a Windows VM under Linux.

    I use VirtualBox software to run a Windows 7 guest.  Once Windows is working in the VM, the rest is easy.  Download the mouse or keyboard software using the browser inside the VM (there are other ways to get the software in there if you already have it downloaded, but this one is the simplest).  Run the software to start the installation inside the VM, and when it asks you to plug in the device (I am assuming it’s already plugged in here), open the Devices menu, which is shown in the screenshot here, and navigate to USB, then to the name of the device you want to program.  Here, I have my K68 keyboard highlighted.

    menu

    Check the box, and you should immediately hear the Windows device connected sound.  Sometimes the device behaves erratically in the virtual Windows after this, and they won’t work outside of the VM at that point either, so you might need to have another keyboard or mouse handy (laptop users have this easy!) to use while the device you are programming is in pass-through mode.  Don’t pass through the other device, though.

    Then you can program the thing the same way as you would on a regular Windows machine.  When you are done, uncheck the box to give the device back to Linux, and your programmed functions should still work.  You can close the VM at that point (be sure to save the snapshot so you can use the mouse or keyboard program again in the future).

    Dell XPS 13/9310, i5-1135G7/16GB, KDE Neon
    XPG Xenia 15, i7-9750H/16GB & GTX1660ti, KDE Neon
    Acer Swift Go 14, i5-1335U/16GB, KDE Neon

    Viewing 1 reply thread
    Author
    Replies
    • #1996932

      So, ultimately, this is about using a mouse and keyboard in VirtualBox?

      (To be honest? I have no interest. Just trying to prune the ‘Topics with no replies’ queue which has recently grown inordinately.)

      • #1997050

        I had mentioned that I use a Windows guest in VirtualBox to program the onboard profiles on my mouse and keyboard, and someone said they were interested in how to do that, and asked for a link to a how-to.  I didn’t have one, so I wrote this.  It doesn’t really need a reply, but now it has some anyway!

        Dell XPS 13/9310, i5-1135G7/16GB, KDE Neon
        XPG Xenia 15, i7-9750H/16GB & GTX1660ti, KDE Neon
        Acer Swift Go 14, i5-1335U/16GB, KDE Neon

    • #1997042

      When you are done, uncheck the box to give the device back to Linux, and your programmed functions should still work. You can close the VM at that point (be sure to save the snapshot so you can use the mouse or keyboard program again in the future).

      Last lines of OP, to clarify for any reader that has interest. Thanks for pruning the list.

    Viewing 1 reply thread
    Reply To: How to use a VM to program mice and keyboards in Linux

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: