Extra mouse buttons on the side or also click on the wheel can be used for copy and paste or any other actions. To make extra buttons work as you need on Linux use next steps from ArchLinux wiki [1].
1. Install xbindkeys and xvkbd
xbindkeys allows to bind mouse buttons to any action like open terminal, open browser, copy to clipboard, paste.
xvkbd allows to send to system keyboard pressing like Ctrl + C, F5 and so on.
apt install xbindkeys xvkbd
2. Find out mouse buttons numbers with xev
Run xev and click on mouse buttons to get their number.
xev -event button | grep button
It will show you info like 'button 8', 'button 9', 'button 0', when you click on first side button, second side button and click on wheel.
2. Write config files for bind mouse side buttons to Ctrl+C, Ctrl+P
cat ~/.xbindkeysrc
"xvkbd -text '\Cv'"
b:2 + Release
"xvkbd -text '\Cv'"
b:8 + Release
"xvkbd -text '\Cc'"
b:9 + Release
3. Run and kill xbindkeys
Test your configuration running and killing xbindkeys with this:
pkill -f xbindkeys
xbindkeys
If everything works, run xbindkeys permanently after boot, add to the end of ~/.xinitrc
xbindkeys
This will run xbindkeys on every boot. There are also other ways to run program after boot.
4. Result: first mouse side button is Ctrl+C, second side button is Ctrl+P
Select text and click first side button (under thumb), this will copy text. Click somewhere to paste and click second side button, it will paste text. Also click on wheel paste text.
5. Configure mouse buttons to copy and paste from terminal: Control + Shift + C with xvkbd
"xvkbd -text '\CV'"
b:2 + Release
"xvkbd -text '\CC'"
b:8 + Release
"xvkbd -text '\Cc'"
b:9 + Release
This example makes one of side buttons copy from terminal Ctrl+Shift+c. Shift+c here is represented as capital C: "xvkbd -text '\CC'".
Also click on mouse wheel now paste to terminal: Ctrl+Shift+v, it is configured like this: "xvkbd -text '\CV'". This paste to terminal and to other applications too.
Reading xvkbd manual and searching by Shift can notice such example here:
man xvkbd
- \S - Shift (modify the next character; please note that modify with ``\S'' will be ignored in many cases. For example, ``a\Cb\ScD\CE'' will be interpreted as a, Control-b, c, Shift-D, and Control-Shift-E.)
So, "\CE" represents Control+Shift+e. It is typing simply \CE instead of \C\Se as in direct logic.
Links
1. ArchLinux Mouse buttons: xvkbd and xbindkeys https://wiki.archlinux.org/title/Mouse_buttons#xvkbd_and_xbindkeys