Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mstuttgart/b14ccfb54a68f7c06238f82c1d4a9907 to your computer and use it in GitHub Desktop.
Save mstuttgart/b14ccfb54a68f7c06238f82c1d4a9907 to your computer and use it in GitHub Desktop.
[Configurando mouse Logitech MX Master 3] Como Configur botões de atalho no Linux. #linux #hardware

Logitech MX Master 3 Extras for Linux With logiops

The Logitech Options program isn't available for Linux, but a nice hacker on GitHub (PixlOne) created an open source project that lets you obtain some of that functionality. It's called logiops. It works in conjunction with the Solaar project as well, which I find especially handy since that shows your available battery life in the system tray and lets you pair/unpair devices with the Logitech Unifying Receiver.

Here are some additional pages with info that I used to generate this documentation:

Installation

Installation instructions for different distributions are available from the developer, but here are the commands for an Ubuntu 20.04 workstation:

sudo apt install cmake libevdev-dev libudev-dev libconfig++-dev
git clone https://github.com/PixlOne/logiops
cd logiops
mkdir build
cd build
cmake ..
make
sudo make install
sudo touch /etc/logid.cfg
sudo systemctl enable --now logid

My /etc/logid.cfg File

This setup is pretty basic. Although gestures are supported and an example config with that is provided within the GitHub project, the only functionality I wanted to add that I couldn't get from Solaar, was a way to launch the GNOME Activities window (i.e. press the Super/Meta/Logo key) with the mouse. Here's how:

echo 'devices: (
{
    name: "Wireless Mouse MX Master 3";
    smartshift:
    {
        on: true;
        threshold: 10;
    };
    hiresscroll:
    {
        hires: true;
        invert: false;
        target: false;
    };
    dpi: 1000;

    buttons: (
        {
            cid: 0x52;
            action =
            {
                type: "Keypress";
                keys: ["KEY_LEFTMETA"];
            };
        }
    );
}
);' | sudo tee /etc/logid.cfg 
sudo systemctl restart logid

Programmable Mouse Buttons

Note that I chose to configure the scroll wheel button, but any of the following buttons are available for you to play with:

  • 0x52 - scroll wheel button
  • 0x53 - back button
  • 0x56 - forward button
  • 0xc3 - thumb button (default "Gesture" button with Logitech Options software)
  • 0xc4 - mode shift button (by default toggles between ratchet and free-spin wheel modes)

Extra Notes

Example output running sudo logid -v after creating /etc/logid.cfg:

[ERROR] I/O Error while reading /etc/logid.cfg: FileIOException
[DEBUG] Unsupported device /dev/hidraw1 ignored
[DEBUG] Unsupported device /dev/hidraw2 ignored
[DEBUG] Unsupported device /dev/hidraw0 ignored
[WARN] Error adding device /dev/hidraw4: std::exception
[INFO] Detected receiver at /dev/hidraw3
[INFO] Device Wireless Mouse MX Master 3 not configured, using default config.
[INFO] Device found: Wireless Mouse MX Master 3 on /dev/hidraw3:1
[DEBUG] /dev/hidraw3:1 remappable buttons:
[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x50 |         |         | YES        | 
[DEBUG] 0x51 |         |         | YES        | 
[DEBUG] 0x52 | YES     |         | YES        | YES
[DEBUG] 0x53 | YES     |         | YES        | YES
[DEBUG] 0x56 | YES     |         | YES        | YES
[DEBUG] 0xc3 | YES     |         | YES        | YES
[DEBUG] 0xc4 | YES     |         | YES        | YES
[DEBUG] 0xd7 | YES     |         |            | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | YES       | YES       
[DEBUG] Thumb wheel resolution: native (18), diverted (120)
@aleemont
Copy link

Hi I'm trying to configure my MX Master 3, but it seems like it's not possibile to bind gestures (with directions) to the thumbwheel actions (tap, touch, proxy). Do you think it's possible?
cat /etc/logid.cfg

// Includes gestures, smartshift, DPI.
// Tested on logid v0.2.3 - GNOME 3.38.4 on Zorin OS 16 Pro
// What's working:
//   1. Window snapping using Gesture button (Thumb)
//   2. Forward Back Buttons
//   3. Top button (Ratchet-Free wheel)
// What's not working:

//   1. Scroll button

// File location: /etc/logid.cfg

devices: ({
  name: "Wireless Mouse MX Master 3";

  smartshift: {
    on: true;
    threshold: 14;
  };

  hiresscroll: {
    hires: true;
    invert: false;
    target: false;
  };

  dpi: 1350; // max=4000
  buttons: (
    //Forward btn 
    {
        cid: 0x56;
        action = {
            type: "Gestures";
            gestures: (
                {
                    direction: "None";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_FORWARD" ];
                    }
                },
                {
                    interval: 5;
                    threshold: 3;
                    direction: "Right";
                    mode: "OnInterval";
                    action = {
                    type: "Keypress";
                    keys: [ "KEY_BRIGHTNESSUP" ];
                    }
                },
                {
                    interval: 5;
                    threshold: 3;
                    direction: "Left";
                    mode: "OnInterval";
                    action = {
                    type: "Keypress";
                    keys: [ "KEY_BRIGHTNESSDOWN" ];
                    }
                }
            );
        };
    },
    //Back btn 
    {
        cid: 0x53;
        action = {
            type: "Gestures";
            gestures: (
                {
                    direction: "None";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_BACK" ];
                    }
                },
                {
                    direction: "Up";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_PLAYPAUSE" ];
                    }
                },
                {
                    direction: "Down";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_MUTE" ];
                    }
                },
                {
                    direction: "Left";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_PREVIOUSSONG" ];
                    }
                },
                {
                    direction: "Right";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_NEXTSONG" ];
                    }
                }
            );
        };
    },
    //Gestures btn 
    {
        cid: 0xc3;
        action = {
            type: "Gestures";
            gestures: (
                {
                    direction: "None";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_LEFTMETA", "KEY_TAB" ];
                    }
                },
                {
                    direction: "Up";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_LEFTMETA", "KEY_UP" ];
                    }
                },
                {
                    direction: "Down";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_W" ];
                    }
                },
                {
                    direction: "Left";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_LEFTMETA", "KEY_LEFT" ];
                    }
                },
                {
                    direction: "Right";
                    mode: "OnRelease";
                    action = {
                        type: "Keypress";
                        keys: [ "KEY_LEFTMETA", "KEY_RIGHT" ];
                    }
                }
            );
        };
    },
    //Top btn 
    {
        cid: 0xc4;
        action = {
            type: "Gestures";
            gestures: (
                {
                    direction: "None";
                    mode: "OnRelease";
                    action = {
                        type: "ToggleSmartShift";
                    }
                },
                {
                    direction: "Up";
                    mode: "OnRelease";
                    action = {
                        type: "ChangeDPI";
                        inc: 200;
                    }
                },
                {
                    direction: "Down";
                    mode: "OnRelease";
                    action = {
                        type: "ChangeDPI";
                        inc: -200;
                    }
                },
            );
        };
    },
  ),
  thumbwheel:
    {
        divert: true;
        invert: false;
        left:
        {
            threshold: 1;
            interval: 1;
            direction: "Left";
            mode: "OnInterval";
            action =
            {
                type: "Keypress";
                keys: ["KEY_VOLUMEDOWN"];
            };
        };
        right:
        {
            threshold: 1;
            interval: 1;
            direction: "Right";
            mode: "OnInterval";
            action =
            {
                type: "Keypress";
                keys: ["KEY_VOLUMEUP"];
            };
        };

        }
        touch:
         {       
             action = {
                type: "Gestures";
                gestures:       (
                   {
                      //threshold: 1;
                      //interval: 1;
                      direction: "Up";
                      mode: "OnRelease";
                      action = {
                         type: "Keypress";
                         keys: ["KEY_LEFTCTRL", "KEY_KPPLUS"];
                      }
                   },
                   {
                      //threshold: 1;
                      //interval: 1;
                      direction: "Down";
                      mode: "OnRelease";
                      action =  {
                         type: "Keypress";
                         keys: ["KEY_LEFTCTRL", "KEY_KPMINUS"];
                      }
                   },
                );
            };
        };
    }
)

systemctl status logid.service

     Loaded: loaded (/usr/lib/systemd/system/logid.service; enabled; preset: disabled)
     Active: active (running) since Thu 2022-09-22 11:02:02 CEST; 13min ago
   Main PID: 22599 (logid)
      Tasks: 7 (limit: 18418)
     Memory: 736.0K
        CPU: 439ms
     CGroup: /system.slice/logid.service
             └─22599 /usr/bin/logid

Sep 22 11:02:02 altair systemd[1]: Started Logitech Configuration Daemon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment