Search Suggest

How To Bind Mouse Buttons To Keyboard Keys Or Commands (Linux Using X11)

If you have a mouse with extra buttons, you can bind those buttons to perform a key combination, run a program, command or script. This will only work if you use X11 (it does not work on Wayland) because the tools we'll use for this only support X11.

To bind the mouse buttons to key combinations we'll use the following tools:

  • xbindkeys: a program that grab keys and mouse button events in X and starts associated shell command
  • xev: a tool that prints contents of X events
  • xdotool: command-line X11 automation tool that lets you programmatically (or manually) simulate keyboard input and mouse activity (and more)

In case you don't need to bind mouse buttons to keyboard keys, and all you want to bind to the mouse buttons are programs, commands or scripts, you can skip the installation of xdotool.

Đăng nhận xét