I've used xbindkeys on Linux to chain button actions of my trackball to do actions, something similar to layers on keyboard. To explain it, let me put an example:
= Press button 8: enter layer 2.
==== Press button 1 in layer 2: "Backward" (ie useful on browser)
==== Press button 3 in layer 2: "Forward" (ie useful on browser)
==== Press button 2 in layer 2: lock screen
and so on.
You can chain buttons ad infinitum like this.
The way to do this is not quite elegant, but just works:
$HOME/.xbindkeysrc
Code: Select all
"/home/user/mouse.sh enter_layer2"
b:8
Code: Select all
#!/bin/bash
case "$1" in
enter_layer2)
# kill main xbindkeys and call xbindkeys with layer2
killall xbindkeys
xbindkeys -f $HOME/.xbindkeysrc_layer2
# at this moment a button press will do something, and go back to main xbindkeys
;;
layer2_button1)
# Left Button
xdotool key XF86Back
killall xbindkeys
xbindkeys
;;
layer2_button2)
# Middle button
xdotool key XF86Forward
killall xbindkeys
xbindkeys
;;
... and son on with as many buttons as wanted
esac
Code: Select all
"/home/user/mouse.sh layer2_button1"
Release + b:1
"/home/user/mouse.sh layer2_button2"
Release + b:2
... and so on
press button 8: enter layer 2
press button 8 on layer 2: enter layer 3
press button 8 on layer 3: enter layer 4 ...
Some example commands to bind to:
xdotool key XF86Back
xdotool key XF86Forward
xdotool key Control+Home (on button 4 which is wheel up, goes to the start of a browser page)
xdotool key Control+End (on button 5 which is wheel down, goes to the end of a browser page)
lock screen with something like alock, i3lock... or put monitor in standby mode
I hope it may be useful for somebody.