How to access extra mouse buttons on Wayland?

Since unfortunately Gnome does not offer any option to configure additional mouse buttons I used to achieve this simple goal by writing a tedious configuration file for xbindkeys.

What I wanted was far from super fancy stuff – as launching a rocket by hitting a mouse button – but only switching workspace by left or right clicking the scroll wheel of my Logitech mouse.

How this is done under Xorg has been answered many times, here for example: How to configure extra buttons in Logitech Mouse

But with Ubuntu 21.04 where – buckle up! – Wayland has become the default display manager, as of now fancy pancy things like xbindkeysand xdotool do not work anymore.

So my question: is there a way to launch missiles – ehm, sorry switch work spaces with my extra mouse button again? Or should I sell them and donate the money to Gnome Fondation?

Please do not propose libratbag and piper, I never got them working in any useful way...


The most comfortable solution I found is key-mapper. This applications allows you, to map mouse buttons to shortcuts. I for example use it to switch workspace with the left and right click of my scroll wheel, what fits particularly good with the horizontal layout of workspaces in GNOME 40+:

enter image description here

As you can see, the program comes with a GUI.

Unfortunately it's not in the Ubuntu sources, but you can download an official DEB packages from here: https://github.com/sezanzeb/key-mapper/releases