I'm trying to emulate mouse movements and actions with keyboard, and I succeeded in remapping everything (e.g.: hjkl to movements), with xkb (in particular using xkbset -m) and xmodmap.

The problem is that buttons are usually pressed one at a time, while I expect to be able to move simultaneously left and up with the mouse.

With xmodmap only seems not to be possible (at the end is only remapping one key on another key), so how can I do in order to move left-up while I am holding h-k simultaneously?

1 Answer 1


I don't know that much (almost nothing) about xmodmap, so I have no direct answer, but I have a few suggestions:

  • map SHIFT and a key to do this
  • use yu,bn for diagonals (<^y >^u Vn)
  • try a different program:
    • xdotool(1) has limited mouse movement and good keyboard emulation
    • keynav(1) is a program that could solve your problems completely
  • You might already have xdotool, and it is included as part of and used by keynav.
    – Wezl
    Apr 17, 2020 at 19:48
  • both are pretty customizeable
    – Wezl
    Apr 17, 2020 at 19:48
  • Thank you, I already map the diagonal movements, but it is uncomfortable and a little bit unnatural, since when I start pressing down and then right I don’t expect to have to remember that instead I should start pressing something else (it’s not my use case but imagine to do it inside a game when you are controlling a character)
    – Annibale
    Apr 18, 2020 at 0:33
  • On the other end I already tried with keynav and it’s interesting, but currently it’s not the style I desire, since ai would like to be closer to a mouse, rather than completely alternative, and I saw xdotool but I didn’t figure out how to use it for solving simultaneity issue
    – Annibale
    Apr 18, 2020 at 0:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .