User Tools

Site Tools


ubuntu:mouse:map_mouse_buttons_to_arbitrary_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ubuntu:mouse:map_mouse_buttons_to_arbitrary_functions [2021/10/25 23:30] – [Assign a function to a Mouse Button] peterubuntu:mouse:map_mouse_buttons_to_arbitrary_functions [2021/10/26 08:57] (current) peter
Line 9: Line 9:
   * **xvkbd** can send a keyboard key signal or mouse click to other programs.   * **xvkbd** can send a keyboard key signal or mouse click to other programs.
   * **xdotool** can simulate keyboard input and mouse activity, move and resize windows, etc.   * **xdotool** can simulate keyboard input and mouse activity, move and resize windows, etc.
- 
----- 
- 
-[[Ubuntu:Mouse:Map Mouse Buttons to Arbitrary Functions:|Map Mouse Buttons to Arbitrary Functions]] 
  
 ---- ----
Line 58: Line 54:
 **NOTE:**  The format of this file is a series of paired lines. **NOTE:**  The format of this file is a series of paired lines.
  
-  The first line is a command to be executed for an event;+  The first line is a command to be executed for an event;
     * The quotation marks ("") around the command is required.     * The quotation marks ("") around the command is required.
-  The second line is the associated mouse button.+  The second line is the associated mouse button.
     * The first mouse button (left) is called b:1, the second b:2 and so forth.     * The first mouse button (left) is called b:1, the second b:2 and so forth.
 </WRAP> </WRAP>
Line 79: Line 75:
 <WRAP info> <WRAP info>
 **NOTE:**  This binds __button 6__ to the __home__ key **NOTE:**  This binds __button 6__ to the __home__ key
 +
 +  * Raw keycodes can be used too, for example: <code>
 +"xte 'keydown Home' 'keyup Home'"
 +m:0x0 + b:6 
 +</code>
 +
 +See: [[Ubuntu:Mouse:Map Mouse Buttons to Arbitrary Functions:Identify the key codes to use|Identify the key codes to use]]
 +
 </WRAP> </WRAP>
  
-Other example:+---- 
 + 
 +==== Another examples ==== 
 + 
 +<file bash ~/.xbindkeysrc> 
 +# Refresh 
 +"xte 'key F5'" 
 +  b:4 + control 
 +</file> 
 + 
 +<WRAP info> 
 +**NOTE:** This maps: 
 + 
 +  * This will cause the forward mouse button and the CTRL key to emulate pressing the F5 key. 
 +  * This is useful for refreshing a web page without moving your hand off the mouse. 
 + 
 +</WRAP> 
 + 
 +---- 
 + 
 +==== Other examples ====
  
 <file bash ~/.xbindkeysrc> <file bash ~/.xbindkeysrc>
Line 101: Line 125:
 </WRAP> </WRAP>
  
 +----
  
-More complex examples:+==== More complex examples ====
  
 +<file bash ~/.xbindkeysrc>
 "/usr/bin/xte 'mouseclick 1' 'mouseclick 1' &" "/usr/bin/xte 'mouseclick 1' 'mouseclick 1' &"
 b:8 + Release b:8 + Release
Line 109: Line 135:
  
 <WRAP info> <WRAP info>
-**NOTE:**  This maps a double-left-click to button 8,+**NOTE:**  This maps a double-left-click to button 8.
  
   * The **Release** option catches __release__ events instead of __press__ events.   * The **Release** option catches __release__ events instead of __press__ events.
Line 117: Line 143:
 ---- ----
  
-===== Additional xbindkeys Configurations =====+====== Restart xbindkeys ======
  
-Here are some examples of additional entries. +If any changes are made to the config file then xbindkeys needs to be restarted:
- +
-<file bash ~/.xbindkeysrc> +
-# Back changed to Copy +
-"xte 'keydown Control_L' 'key C' 'keyup Control_L'" +
-  b:8 +
- +
-# Forward +
-"xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'" +
-  b:9 +
-</file+
- +
-<WRAP info> +
-**NOTE:**  This maps: +
- +
-  * Back button: 8 +
-    * When Button 8 on the mouse is pressed, send a CTRL-C followed by a Key up. +
- +
-  * Forward button: 9  +
-    * When Button 9 on the mouse is pressed, send a ALT followed by a Key up. +
- +
-</WRAP> +
- +
----- +
- +
-====== Run at startup ====== +
- +
-One approach is to create a shell script that performs the Mouse Button mapping:+
  
 <code bash> <code bash>
-echo "xinput --set-button-map 21 3 2 1" > leftmouseremap.sh+killall xbindkeys 
 +xbindkeys
 </code> </code>
  
-Give it executable permission: 
  
-<code bash> 
-chmod +x leftmouseremap.sh  
-</code> 
  
-<WRAP info> +----
-**NOTE:**  Either run the script manually, or configure it to automatically run on system reboot.+
  
-  * Follow any process to have this script run at boot if needed.+====== References ======
  
-  * Remember to configure 'xbindkeys' to run automatically on system startup too if needed: +https://linux.die.net/man/7/xautomation
-    * '/usr/bin/xbindkeys'+
  
-</WRAP>+https://manpages.debian.org/stretch/xautomation/xte.1
  
 +https://linux.die.net/man/1/xte
  
----- 
- 
-====== References ====== 
- 
-https://linux.die.net/man/7/xautomation 
  
ubuntu/mouse/map_mouse_buttons_to_arbitrary_functions.1635204618.txt.gz · Last modified: 2021/10/25 23:30 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki