There are various options that can be used to allow a mouse button click to action an arbitrary function.
These include:
sudo apt install xbindkeys
NOTE: Xbindkeys is a program that allows to bind commands to certain keys or key combinations on the keyboard.
sudo apt install xautomation
NOTE: This provides the xte program; which can generate fake input, including keystrokes and mouse-clicks.
xbindkeys --defaults > $HOME/.xbindkeysrc
NOTE: The $HOME/.xbindkeysrc file could also be created manually.
NOTE: The format of this file is a series of paired lines.
Edit the xbindkeys Configuration file, ~/.xbindkeysrc:
Add commands similar to this:
"xte 'keydown Home' 'keyup Home'" b:6
NOTE: This binds button 6 to the home key
"xte 'keydown Home' 'keyup Home'" m:0x0 + b:6
# Refresh "xte 'key F5'" b:4 + control
NOTE: This maps:
# Back "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'" b:8 # Forward "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'" b:9
NOTE: This maps:
"/usr/bin/xte 'mouseclick 1' 'mouseclick 1' &" b:8 + Release
NOTE: This maps a double-left-click to button 8.
If any changes are made to the config file then xbindkeys needs to be restarted:
killall xbindkeys
xbindkeys