Forrest logo
back to the xmodmap tool

xmodmap:tldr:48cca

xmodmap: Swap left-click and right-click on the pointer.
$ xmodmap -e 'pointer = 3 2 1'
try on your machine

The command "xmodmap -e 'pointer = 3 2 1'" is used to modify the mapping of buttons on a mouse or pointer device in X Window System. Here's a breakdown of each part:

  • "xmodmap" is a utility in X Window System that allows users to alter the keymap and pointer button mappings.
  • "-e" is an option that indicates the command will be specified as the next argument.
  • "'pointer = 3 2 1'" is the command itself, enclosed in single quotes.

The command specifically modifies the pointer button mapping. The numbers 3, 2, and 1 represent the new button mappings. In X Window System, the buttons are usually numbered from 1 to 3, with 1 being the left button, 2 being the middle button, and 3 being the right button.

By executing this command, the button mapping is changed so that the left button functions as the right button, and the right button functions as the left button. The middle button remains unaffected with a mapping of 2.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the xmodmap tool