Skip to content

Instantly share code, notes, and snippets.

@yuryroot
Last active January 5, 2026 18:58
Show Gist options
  • Select an option

  • Save yuryroot/84091c869babf3c5c3102ec86daeece8 to your computer and use it in GitHub Desktop.

Select an option

Save yuryroot/84091c869babf3c5c3102ec86daeece8 to your computer and use it in GitHub Desktop.
// Logitech MX Master 4 Button Mapping
// 0x0c4 → Top button behind scroll wheel (MagSpeed toggle)
// 0x052 → Middle click (wheel press) (Standard middle click)
// 0x053 → Back button (side) (Browser Back)
// 0x056 → Forward button (side) (Browser Forward)
// 0x0c3 → Gesture button (Gesture button) (Media gesture hub)
// 0x1a0 → Thumb button (bottom-left corner) (Super/Meta key)
// Configuration for Logitech MX Master 4
// Full gesture implementation on the gesture button for media control
// Source: https://github.com/PixlOne/logiops/issues/520
devices: (
{
name: "MX Master 4";
// Set the DPI.
dpi: 1000;
// Enable smartshift to automatically switch between ratchet and free-spin.
smartshift: {
on: true;
threshold: 15;
};
// Enable high-resolution scrolling for a smoother feel.
hiresscroll: {
on: true;
};
buttons: (
// ── Top button (behind scroll wheel) ── Toggles SmartShift
{
cid: 0xc4;
action: {
type: "ToggleSmartshift";
};
},
// ── Back button (side) ──────────────── Browser Back
{
cid: 0x53;
action: {
type: "Keypress";
keys: [ "KEY_BACK" ];
};
},
// ── Forward button (side) ───────────── Browser Forward
{
cid: 0x56;
action: {
type: "Keypress";
keys: [ "KEY_FORWARD" ];
};
},
// ── Thumb rest click ────────────────── Super/Windows key
{
cid: 0x1a0;
action: {
type: "Keypress";
keys: [ "KEY_LEFTMETA" ];
};
},
// ── Gesture button ──────────────────── Media Gestures
{
cid: 0xc3;
action: {
type: "Gestures";
gestures: (
// Hold + Move Up ──────────────── Volume Up
{
direction: "Up";
mode: "OnRelease";
action: {
type: "Keypress";
keys: [ "KEY_VOLUMEUP" ];
};
},
// Hold + Move Down ────────────── Volume Down
{
direction: "Down";
mode: "OnRelease";
action: {
type: "Keypress";
keys: [ "KEY_VOLUMEDOWN" ];
};
},
// Hold + Move Left ────────────── Previous Track
{
direction: "Left";
mode: "OnRelease";
action: {
type: "Keypress";
keys: [ "KEY_PREVIOUSSONG" ];
};
},
// Hold + Move Right ───────────── Next Track
{
direction: "Right";
mode: "OnRelease";
action: {
type: "Keypress";
keys: [ "KEY_NEXTSONG" ];
};
},
// Simple click (no movement) ──── Play/Pause
{
direction: "None";
mode: "OnRelease";
action: {
type: "Keypress";
keys: [ "KEY_PLAYPAUSE" ];
};
}
);
};
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment