Using Logitech MX Master 3 Mouse Thumb Button to Activate Window Switcher with xbindkeys in Linux
In this article, we will explain how to utilize the thumb button on the Logitech MX Master 3 mouse to activate the window switcher in Linux. We will cover the key concepts, including the use of xbindkeys, a popular Linux utility for binding keys to actions, and the necessary configurations for achieving this task.
Prerequisites
To follow along, make sure you have the following:
- A Linux distribution installed (we are using Ubuntu 24.10 in this example)
- A Logitech MX Master 3 mouse
Installing xbindkeys
xbindkeys is a utility that allows you to bind keys or mouse buttons to commands. To install xbindkeys in Ubuntu, use the following command:
sudo apt-get install xbindkeys
Identifying the Thumb Button
To identify the thumb button on the Logitech MX Master 3 mouse, you can use the xev command, which displays the X events for the mouse and keyboard. Open a terminal window and execute the following command:
xev
Now, click the thumb button on your mouse. You will see a series of events on your terminal screen. Look for the "button" event and note down the number associated with the thumb button. In our example, it is button 8.
Configuring xbindkeys
Create a configuration file for xbindkeys with your preferred text editor:
nano ∼ ~/.xbindkeysrc
In the configuration file, add the following lines:
"# Logitech MX Master 3 Thumb Button for Window Switcher"
m:0x10 + b:8 >w >
exec gnome-terminal --window-with-profile=focus & sim; wmctrl -a :ACTIVE:
Make sure to replace the button number (8 in this example) with the number you identified from the xev command. Here, we are using the "gnome-terminal" command to open a new terminal window and "wmctrl" to switch to the active window. Save the configuration file after editing.
Starting xbindkeys
Now, start xbindkeys to apply the new configuration:
xbindkeys
You can add xbindkeys to your startup applications so that it runs automatically at login. Make sure to restart your system after adding it to the startup applications for the changes to take effect.
Using the Window Switcher
With the configuration in place, you can now use the thumb button on your Logitech MX Master 3 mouse to switch between open windows. If you want to scroll and select one window from the list, you can use the Super + Tab key combination instead. This will open the window switcher in a more accessible way.
- xbindkeys is a Linux utility that allows you to bind keys or mouse buttons to commands.
- The thumb button on the Logitech ```scss MX Master 3 mouse can be identified using the xev command.