How to Activate Mouse Keys in X-Free

Mouse keys is a feature that allows you to map the numeric keypad on your keyboard to the mouse buttons inside of a graphical user interface. This is useful since it helps you to keep your keys on the keyboard while typing and using the mouse at the same time. Sometimes people turn on this function for accessibility reasons or even because their mouse broke and they don’t have a replacement just yet.

While the X Window System used in Linux predates Linux by a long shot and standardized this feature in 1984, modern distributions of Linux actually neglect to provide decent tools to turn it on. Debian, Ubuntu and Fedora users may or may not have a graphical tool in their settings panel to configure it. Fortunately there’s a trick that works in every distribution that relies on X-Free.

Activating Mouse Keys with an X-Free Tool

Open a graphical command prompt by either holding down CTRL and ALT while pushing T or select it from the root menu of your desktop environment. Type setxkbmap -option keypad:pointerkeys then press enter. Make sure the Num Lock light on your keyboard is off, then hold down Shift and push Num Lock. The light should come on. Pressing the 8, 4, 6 and 2 keys on the number pad will now move the mouse cursor while the 5 key will click it. Push the * key on the number pad to shift the 5 key’s function to the middle mouse button and then use the – key on the number pad to make it right click. Push the number pad’s forward slash to send it back to the left button.

Typing all of this each time you want to use mouse keys is a bit silly, so it’s easy enough to make a Bash script to do it automatically. Type cd ~/.local and press enter followed by ls and press enter. If there’s a directory called bin then type cd bin and press enter, but if there isn’t then type mkdir bin press enter, then type cd bin and press enter. From there type each of the following lines, pressing enter at the end of each:

cat >> mousekeys


setxkbmap -option keypad:pointerkeys


When you get to the end, hold down CTRL and push D. Open your graphical file manager either by selecting it from the root menu or holding down the Windows key and pushing E. Navigate to ~/.local/bin and right click on the mousekeys file. Click on the Permissions tab and make sure it’s set to View content: Anyone, Change content: Only owner and Execute: Anyone.


Then you can run the script at all time from any user shell by typing mousekeys and pressing return followed by holding down Shift and pushing Num Lock.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Activate Mouse Keys in X-Free

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested