If you are using a mouse, trackball, or touchpad with extra buttons in Windows, chances are the manufacturer has created software to configure the buttons. Rarely do they create such software for Linux. Btnx (button x) can be used to configure the mouse buttons in Linux for a variety of pointing devices.
With a three button mouse, typically people keep the default settings. With a five button mouse, the extra two buttons often go unused. The default is that they typically are used to go back and forward in web browsers and file managers. This is not as handy in other programs. Other functions might be more useful; the user should decided what they need. For example, I would rather use the extra buttons to copy and paste text. Enter btnx.
To install btnx, search for it in Ubuntu's Software Center (found in the Application menu). Alternatively, you can install it from the command line.
sudo apt-get install btnx
Now you can access btnx from:
Applications > System Tools > btnx
This will bring up a GUI dialog box for you to configure you mouse. From here, click "Detect mouse & buttons" and follow the steps. It will have you test your mouse and label the buttons. Don't forget to add your scroll wheel. It is an extra step compared to manufacturers' software, but it only takes a minute or two. Next, click on the "Buttons" tab to configure what each button does. Usually, it is the extra mouse buttons that are the best to customize, but any can be changed.
In this case, I set the keycode on "Button-1" (named by me) to "C" and the modifier to "Ctrl." Since this is just a case of simulating "ctrl+c" to copy something, left or right control keys are irrelevant. Naturally, I set the "Button-2" as "ctrl-v" for paste. Page Up & Page Down would also make sense. Options are not limited to key combinations. Programs and other buttons can be set as well. A wide array of functions are available for someone to choose from.
Make sure to click the "Enabled" check box. To apply the changes, restart btnx from the "Configurations" tab. If a change does not seem to be taking place, try restarting btnx or your computer.
Note: The homepage and the help files were not available. For clarification and program details, use the man pages from the Wayback Machine.
Problems and Issues
In tests, while the remapping worked, a curious side effect evolved: the buttons now work as both copy & paste and forward & back. This made them useless in websites. Further research lead to a fix: xinput. The program will let you swap or disable mouse buttons, among other things. It should come with Ubuntu and other types of Linux, but it can be installed from the terminal:
sudo apt-get install xinput
Once installed, you need to use it to list and show devices:
You should see your pointing device listed. Look for your manufacturer's name. If the name appears twice, then you need to use the "id" number in place of the name. Once you have found this information, you can disable the extra button functionality with the following line:
xinput set-button-map "Your mouse name" 1 2 3 4 5 6 7 0 0
Now, your mouse should work as intended. Btnx will still know you are pressing the buttons, so the remap will still work. If you have problems, try running through "Detect mouse & buttons" again to make sure they were set correctly. Note: You may have to do this each time you customize the buttons.
It took some time to find the answers, but I now have perfectly functional copy & paste buttons on my trackball. These solutions where found in the forums at ubuntuforums and pinoygeek. With luck, you will not have the problems that I ran into. If you do, I hope this article saves you the trouble of having to research the solution. Please feel free to share how you remap your mouse in the comments.Advertisement
If you like our content, and would like to help, please consider making a contribution: