Setting Custom Mouse Actions Edit on GitHub


For using xbindkeys open a terminal with the following keys:

Pop!_OS : + T

Ubuntu : CTRL+ALT+T

Then install the following packages:

sudo apt install xbindkeys xautomation

Then create the default config file for xbindkeys with this command:

xbindkeys --defaults > $HOME/.xbindkeysrc

Setting custom actions

Now let’s open the config file with this command:

gedit ~/.xbindkeysrc

Then scroll down to the bottom of the file right below this line:

   control+shift + q

From here you can add your own custom actions like the ones below.


Below are some examples that you can do:

# Refresh
"xte 'key F5'"
  b:9 + control

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.

# Workspace Up
"xte 'keydown Control_L' 'keydown Super_L' 'key Up' 'keyup Super_L' 'keyup Control_L'"

# Workspace Down
"xte 'keydown Control_L' 'keydown Super_L' 'key Down' 'keyup Super_L' 'keyup Control_L'"

This will cause the forward and back mouse button to emulate pressing the Ctrl++Up and Down. This is useful for switching workspaces very quickly while leaving your hand on the mouse.


If any changes are made to the config file then xbindkeys need to be restarted with these commands:

killall xbindkeys

By default xbindkeys does not start on reboot and you will need to add it using the Startup Application Preferences.

Startup Applications Pref

Once the application is opened then click the Add button then name the program to something like ‘xbindkeys’, enter the command for the application which is ‘xbindkeys’. Now click the Add button and your done!


Once the mouse buttons for forward and back are set to a different action they will no longer work in a web browser for going back and forth between web pages.

Article last modified: 2021-01-20