Need some help on a pet project of mine (remapping mouse control so that I can move the pointer with my keyboard)

After getting a replacement keyboard for my Thinkpad, the track point on my new keyboard no longer works the way I want. A lot of pressure has to be applied to the track point to control the mouse pointer (this is true even though I have created a udev rule to set the device’s sensitivity attribute to the highest). This sucks because now I have to use the track pad to move the pointer, which means taking my fingers off the home row.

Given the circumstances, I decided that the best way around this is to re-map the mouse controllers to certain keys on the keyboard. That way, I can still move the mouse pointer without taking my fingers off the home row.

So far, my plan is as follows:

  1. Create a keybinding in my i3 config that would launch a script. Perhaps something like: bindsym $mod+space exec --no-startup-id /some/script/to/perform/the/
  2. Create a keybinding in my i3 config that would launch another script, this time to reset the mapping back to default.

That way, I would have two keybindings: one to switch on the “control mouse with keyboard” feature, and another one to turn if off.

The problem I’m facing now is that I’m not entirely sure how to write the scripts (since I’m such a newb). My intuition tells me that I have to use something like xinput to do it, but my experience with using that command is limited.

So far, I only managed to use it to disable the “middle-click feature” by doing something like this:

#15 = IBM Trackpoint
#14 = Synaptics Trackpad
xinput set-button-map 15 1 25 3 4 5 6 7
xinput set-button-map 14 1 25 3 4 5 6 7

How do I use xinput to re-map only the controls to move the mouse button left, right, up, and down? I’m using a thinkpad, so I’m still planning to use the click buttons to click—as in these buttons:


I just want to use normal keys to move my mouse pointer (hjkl keys, like in vim)

Does anyone have any advice?

Things I’ve tried:

  1. I tried to figure out the numbers corresponding to left, right, up, and down using xinput test 15, but the numbers don’t make sense:
    When I push the track point down it gives: a[1]=(some number)
    When I push the track point up, it gives : a[0] = (some number)
    When I push the track point left, it gives: a[0] again???

But at least I know that left click = 1, right click = 3.

Not an i3 user, but this looks interesting:

1 Like


Hi. Thanks for the answer. Yes. I did consider doing it with xdotool before this, but the problem is that I found it puts too much load on my CPU when I hold down the keys. I could always input a larger distance to xdotool, but sometimes I need more fine tuned control of the mouse pointer.

That’s why I thought it would be better to remap the buttons of my trackpoint (device 15) to keyboard keys, at least temporarily.

Here’s another tool that may help