For example, using the X11 key event emulator built into evrouter: The line that ends with "fill this in!" can be copied into the config file which by default is ~/.evrouterrc. "Microsoft Trackball Explorer®" "/dev/input/event1" none key/276 "fill this in!" "Microsoft Trackball Explorer®" "/dev/input/event1" none key/275 "fill this in!" Now press the buttons that you wish to change: $ evrouter -dump /dev/input/event* device 0: /dev/input/event0: AT Translated Set 2 keyboardĭevice 1: /dev/input/event1: Microsoft Microsoft Trackball Explorer®ĭevice 2: /dev/input/event2: Sleep Buttonĭevice 3: /dev/input/event3: Power Buttonĭevice 4: /dev/input/event4: Power Button Tip: For USB devices udev will usually create symbolic links in /dev/input/by-id/ which can be used to refer to specific devices. This is an example for a keybinding for Meta+M: "xvkbd -no-jump-pointer -text "\D1$(xsel)" 2>/dev/null" Here is an example for xbindkeys to enable x selection paste(third click pasting), you need both xsel and xvkbd installed, What it does it executes that command whenever button 13 of the mouse is pressed (in ~/.xbindkeysrc) : Do not forget to type capital letters in xvkbd -text usage and to escape opening bracket with \ or you get simply written. If you want to check your mouse buttons number use xev.
#How to keybind a mouse how to
The problem we will encounter is that we do not know how to emulate a key press. Let us say we want to bind some mouse buttons to keyboard ones. Reason: Duplicates xbindkeys, assumes xvkbd instead of linking Xorg#Automation. Binding mouse buttons to keyboard functions xte Key-mapper-git AUR is a GUI tool with a simple interface to remap your mouse and or keyboard keys. This section covers details of using various tools to rearrange mouse and keyboard functions. You can use xev to confirm your mouse button numbers and to confirm that X is being notified of mouse clicks. This corresponds to a left mouse click and release followed by a thumb-tip click and release. for an Logitech MX Master 3 the scroll wheel is 4 & 5, thumb wheel is 6 & 7, the thumb-tip button is 9, and the inner-thumb button is 8). For most mice, this will be '1' for left button, '2' for middle, '3' for right. Since you are filtering for lines which contain "button" it will show mouse click and release events with their relevant button numbers. A window will pop up by runningĪny xevents (like moving, resizing, or clicking in) that window will then be reported to the console you launched xev from. X events can be displayed by the xev utility. You will first want to check what X sees from your mouse. This page assumes you are using Xorg ( X Window System) and not Wayland. 2.3 Binding keyboard keys to mouse buttons.2.2 Binding mouse buttons to keyboard functions.2 Rebinding mouse and keyboard functions.1 Prerequisite testing mouse input in X.