ubuntu:mouse:map_mouse_buttons
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:mouse:map_mouse_buttons [2021/10/25 09:51] – [Additional xbindkeys Configurations] peter | ubuntu:mouse:map_mouse_buttons [2021/10/26 14:07] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - Mouse - Map Mouse Buttons ====== | ====== Ubuntu - Mouse - Map Mouse Buttons ====== | ||
+ | |||
+ | In most cases, | ||
+ | |||
+ | * Buttons 1, 2, 3 are interpreted as left, middle, right. | ||
+ | * Logical buttons 4, 5, 6, 7 are usually interpreted as scroll up, down, left, right. | ||
+ | * The fourth and fifth physical buttons on a device will thus send logical buttons 8 and 9. | ||
+ | |||
+ | ---- | ||
* [[Ubuntu: | * [[Ubuntu: | ||
Line 6: | Line 14: | ||
---- | ---- | ||
- | ===== Map the Mouse Buttons | + | ===== Map a Mouse Button to Another Button |
+ | |||
+ | This can be useful for changing the mouse for left-handed people. | ||
+ | |||
+ | * The left and right buttons could be swapped around (the 3 and 1 are switched). | ||
<code bash> | <code bash> | ||
- | xinput set-button-map 8 1 0 3 4 5 6 7 8 9 | + | xinput set-button-map 8 3 2 1 4 5 6 7 8 9 |
</ | </ | ||
Line 15: | Line 27: | ||
**NOTE: | **NOTE: | ||
- | * The remaining **1 0 3 4 5 6 7 8 9** is the 9 mouse buttons as determined above. | + | * The remaining **3 2 1 4 5 6 7 8 9** is the 9 mouse buttons as determined above. |
- | * Here, button 2 is replaced by a zero. | + | * Usually this would be in the order **1 2 3**, where |
- | * This disables this button. | + | * **1**: is the left mouse button. |
+ | * **2**: is the middle mouse button. | ||
+ | * **3**: is the right mouse button. | ||
- | * For left-handed people, the left and right buttons could be swapped around (the 3 and 1 are switched). | + | * Here, button 3 is swapped with button 1. |
- | * **3 2 1 4 5 6 7 8 9** | + | * This means that when the actual |
+ | * Also, clicking on the actual right mouse button results in a left-click. | ||
</ | </ | ||
Line 27: | Line 42: | ||
---- | ---- | ||
- | ===== Mapping | + | ===== Disable a Specific |
- | + | ||
- | ==== Install xbindkeys | + | |
<code bash> | <code bash> | ||
- | sudo apt install xbindkeys | + | xinput set-button-map 8 1 0 3 4 5 6 7 8 9 |
</ | </ | ||
- | ---- | + | <WRAP info> |
+ | **NOTE: | ||
- | ==== Install xautomation ==== | + | * The remaining **1 0 3 4 5 6 7 8 9** is the 9 mouse buttons as determined above. |
- | <code bash> | + | * Here, button 2 is replaced by a zero. |
- | sudo apt install xautomation | + | * This disables this button. |
- | </ | + | |
- | ---- | + | </WRAP> |
- | + | ||
- | ==== Create the xbindkeys Configuration File ==== | + | |
- | + | ||
- | <code bash?> | + | |
- | xbindkeys --defaults > $HOME/.xbindkeysrc | + | |
- | </code> | + | |
---- | ---- | ||
- | ==== Edit the xbindkeys Configuration File ==== | + | ====== Run at startup ====== |
- | Edit **~/ | + | One approach is to create a shell script that performs the Mouse Button mapping: |
- | * To create a double-click event when button | + | <code bash> |
+ | echo " | ||
+ | </ | ||
- | <file bash ~/ | + | Give it executable permission: |
- | "/ | + | |
- | b:8 + Release | + | |
- | </ | + | |
- | <WRAP info> | + | <code bash> |
- | **NOTE: | + | chmod +x leftmouseremap.sh |
- | + | </code> | |
- | * The first line is a command to be executed for an event; | + | |
- | * The second line is the event description. | + | |
- | + | ||
- | Here, the **xte** component of xautomation to send events directly to the input handler. | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ==== Additional xbindkeys Configurations ==== | + | |
- | + | ||
- | Here are some examples of additional entries. | + | |
- | + | ||
- | <file bash ~/ | + | |
- | # Back changed to Copy | + | |
- | "xte ' | + | |
- | b:8 | + | |
- | + | ||
- | # Forward | + | |
- | "xte ' | + | |
- | b:9 | + | |
- | </file> | + | |
<WRAP info> | <WRAP info> | ||
- | **NOTE: | + | **NOTE: |
- | * Back button: 8 | + | * Follow any process to have this script run at boot if needed. |
- | * Forward button: 9 | + | |
+ | * Remember to configure ' | ||
+ | * '/ | ||
- | Remember to configure ' | + | </ |
- | * '/ | ||
- | |||
- | </ | ||
---- | ---- | ||
Line 107: | Line 90: | ||
http:// | http:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | https:// |
ubuntu/mouse/map_mouse_buttons.1635155513.txt.gz · Last modified: 2021/10/25 09:51 by peter