Get the most out of your mouse with btnx


Author: Dmitri Popov

When you have shelled out for a swanky mouse like the Logitech VX Nano, you want to make the most out of your investment, which means making its programmable buttons work. However, many Linux distributions recognize most mice as generic pointing devices, so none of the fancy extra buttons work right out of the box. The btnx utility can help you to turn your mouse into the versatile tool it is meant to be.

btnx comes in two parts: the btnx daemon that does the behind-the-scenes work of managing mouse button events, and the btnx-config tool, a graphical front end that helps you configure mouse button actions. btnx’s Web site provides packages for Ubuntu and openSUSE, as well as source code archives for other distributions. As often happens, the packages are a step behind the source code distribution, so if you want to install the latest version of btnx, you have to go the usual ./configure; make; make install route.

To configure your mouse, launch the btnx-config tool. Begin by identifying your mouse and all its buttons by pressing “Detect mouse & buttons.” btnx-config opens the button detection wizard, which guides you through the process of detecting and labeling the mouse buttons. The detection procedure is straightforward. Press the Start button at the top of the window and keep clicking on a particular mouse button until the progress bar in the Button detection section reaches the end. Give then the button a name and press the Add button. Repeat these steps for the other mouse buttons, and press OK when you are done.

Once all the buttons have been recognized and labeled, you can assign actions to them. Switch to the Button tab and select the mouse button in the left pane. Select the key you want to assign to the button from the Keycode drop-down list in the Key combination section. For example, if you want the Zoom button on the Logitech VX Nano mouse to act as a middle button, select the BTN_MIDDLE item. You can also assign up to three modifier keys, which allow you to define complex mouse button actions. Using this feature you can, for example, program the VX Nano’s tilting scroll wheel to move back and forth between pages in Firefox. To do this, you have to specify the appropriate keycode (KEY_RIGHT for right tilt and KEY_LEFT for left tilt) and specify the KEY_LEFTALT modifier key, which emulates the left Alt key on the keyboard. When assigning a keyboard combination to a mouse button, remember to tick the Enable check box to activate the specified key button mapping.

Besides key combinations, you can use mouse buttons to execute user-defined commands. For example, you can use the Zoom button to launch a text editor, KDE Control Center, or something else. To do this, select the Command execution item from the Event type drop-down list, and enter the command you want in the Execute command field.

btnx supports multiple configuration profiles, which can come in handy if you use two or more mice with your computer (for example, you might use a fancy trackball when you are working at your desk and a notebook mouse when you are on the move).

After you’ve laboriously configured all the buttons to your liking, you might want to transfer the settings to another machine, or just back up the settings. To do this, press the Backup button and save the created backup file in the desired location. The Restore button allows you to restore the settings from a saved backup file when needed.

Final word

If you have a mouse with programmable buttons, you ought to give btnx a try. It allows you to unleash your mouse’s potential and turn it into a powerful and versatile tool. In fact, btnx ought to ship with every distribution, and it’s a bit surprising that btnx isn’t included in the software repositories of many popular Linux distros by default.


  • Tools & Utilities
  • Desktop Software