logiops,在 Linux下设置罗技 Wireless Mouse MX Master 3 按键和手势

安装

Dependencies

因为系统是 UOS,自带GCC版本8.3太老,默认 std  2014, 其他修改不可行
版本 最新3.3, c++20,
3.2, c++20
3.0 , c++17
均测试不通过 ,下午6点重新编译,本机 gcc12 for UOS,结果C库不兼容,编译通过,但是运行出错。还原,使用 2.4 版本没有依赖,直接通过
测试正常

下载2.4 的zip包 ,解压后,看到 README .MD 文件。

This project requires a C++14 compiler, cmake, libevdev, libudev, and libconfig. For popular distributions, I've included commands below.

Debian/Ubuntu:

sudo apt install cmake libevdev-dev libudev-dev libconfig++-dev

Building

 

mkdir build
cd build
cmake ..
make

安装

sudo make install

设定为守护进程开机启动

sudo systemctl enable --now logid

平常查看运行状态

sudo service logid status

出现问题时重启,这可以解决大部分问题。

sudo service logid restart

debug模式 排除错误

sudo service logid stop
sudo logid -v

快速重启

alias logidd='sudo cp /home/calleng/Desktop/logid.cfg /etc/logid.cfg && sudo systemctl restart logid'

我的配置文件

正在用的系统配置,本来想实现5个按键的鼠标手势捕获,结果不可以。 只有用两个

通过 参数, 每个鼠标按键通过一个cid表示,鼠标按键的cid值可以参考项目页面知道(CIDs),或是通过debug模式查看。

debug模式启动的方法是,先停止服务

0[DEBUG] CID  | reprog? | fn key?   | mouse key? | gesture support?
1[DEBUG] 0x50 |Left  Mouse Button   | YES        | 
2[DEBUG] 0x51 |Right Mouse Button   | YES        | 


3[DEBUG] 0x52 | YES Middle MButton  | YES        | YES
4[DEBUG] 0x53 | YES Back Button     | YES        | YES
5[DEBUG] 0x56 | YES Forward Button  | YES        | YES
6[DEBUG] 0xc3 | YES Gesture Button  | YES        | YES  -----
7[DEBUG] 0xc4 | YES ToggleSmartShift| YES        | YES  ----


8[DEBUG] 0xd7 | YES Switch Receivers|            | YES

9[DEBUG] Thumb wheel detected (0x2150), capabilities:
a[DEBUG] timestamp | touch | proximity | single tap
b[DEBUG] YES       | YES   | YES       | YES       
c[DEBUG] Thumb wheel resolution: native (18), diverted (120)

 

常用快捷键

CTRL+PageUp(网页切换左页面);

往右按滚轮:CTRL+PageDown。

手势按键的配置是,

按下:回车;

往左:复制(CTRL+INSERT);

往右:粘贴(SHIFT+INSERT);

 

我的配置文件,只有两个生效

devices: (
{
    name: "Wireless Mouse MX Master 3";
    smartshift:
    {
        on: true;
        threshold: 30;
        torque: 50;
    };
    hiresscroll:   # 滚轮配置 , 注意,如果你使用的屏幕DPI非常高,不是分辨率,是DPI。启用了高分辨率滚轮会导致滚轮速度非常块,可以关闭调整回正常的速度。
    {
        hires: true;   # 启用高分辨率滚轮
        invert: false;  # 不启用反向滚轮
        target: false;  # 如果滚轮不设其他功能
    };
    dpi: 1000;
    buttons: (
        {
            cid: 0xc3;   #  Gesture Button 
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                        	type:"Keypress";
                        	keys:["KEY_LEFTMETA", "KEY_D"]; # 显示桌面
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                        	type:"Keypress";
                        	keys:["KEY_LEFTMETA", "KEY_S"]; # 多任务视图
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_LEFT"]; # 左虚拟左面
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_RIGHT"]; # 右虚拟桌面
                        }
                    },
                    {
                    direction:"None";
                    mode="OnRelease";
                    action=
                        {
                        type:"Keypress";
                        keys:["KEY_LEFTMETA", "KEY_D"]; #  未知定义,待切换
                        }
                    }
                );
            };
        },
        {
            cid: 0xc4;  #  ToggleSmartShift
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_UP"];  # 窗口最大化
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_DOWN"]; # 窗口正常
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTCTRL", "KEY_PAGEUP"];   # 标签左切换
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTCTRL", "KEY_PAGEDOWN"];  # 标签右边切换
                        }
                    },
                    {
                    direction:"None";
                    mode="OnRelease";
                    action=
                        {
                        type:"Keypress";
                        keys:["KEY_LEFTCTRL", "KEY_W"]; # 直接关闭窗口
                        }
                    }
                );
            };
        }
    );
}
);

 

 

暂时没有搞懂的配置文件

 

devices: (
{
    name: "Wireless Mouse MX Master 3";
    smartshift:
    {
        on: true;
        threshold: 30;
        torque: 50;
    };
    hiresscroll:   # 滚轮配置 , 注意,如果你使用的屏幕DPI非常高,不是分辨率,是DPI。启用了高分辨率滚轮会导致滚轮速度非常块,可以关闭调整回正常的速度。
    {
        hires: true;   # 启用高分辨率滚轮
        invert: false;  # 不启用反向滚轮
        target: false;  # 如果滚轮不设其他功能
    };
    dpi: 1000;

    buttons: (
        {
            cid: 0xc3;   #  Gesture Button 
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                        	type:"Keypress";
                        	keys:["KEY_LEFTMETA", "KEY_D"]; # 显示桌面
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                        	type:"Keypress";
                        	keys:["KEY_LEFTMETA", "KEY_S"]; # 多任务视图
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_LEFT"]; # 左虚拟左面
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_RIGHT"]; # 右虚拟桌面
                        }
                    },
                    {
                    direction:"None";
                    mode="OnRelease";
                    action=
                        {
                        type:"Keypress";
                        keys:["KEY_LEFTMETA", "KEY_D"]; #  未知定义,待切换
                        }
                    }
                );
            };
        },
        {
            cid: 0xc4;  #  ToggleSmartShift
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_UP"];  # 窗口最大化
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_DOWN"]; # 窗口正常
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTCTRL", "KEY_PAGEUP"];   # 标签左切换
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTCTRL", "KEY_PAGEDOWN"];  # 标签右边切换
                        }
                    },
                    {
                    direction:"None";
                    mode="OnRelease";
                    action=
                        {
                        type:"Keypress";
                        keys:["KEY_LEFTALT", "KEY_F4"]; # 直接关闭窗口
                        }
                    }
                );
            };
        },
        {
            cid: 0x56;   # Forward Button
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                            type: "CycleDPI";         # 自动调节 DPI 分辨率
                            dpis: [400, 600, 800, 1000, 1200, 1400, 1600];
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                            type = "ToggleSmartshift";   # 激活自动快速滚轮
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTMETA", "KEY_E"];  # 资源管理器
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_T"];   # 终端管理器
                        }
                    },
                    {
                        direction: "None"    # 保持为空
                        mode: "NoPress"
                    }
                );
            };
        },
        {
            cid: 0x53;  # Back Button
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";      # 图文识别
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_C"];
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                            type = "Keypress";   # 语音朗读
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_P"];
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";      # 语音听写
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_D"];
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";       # 文本翻译
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_U"];
                        }
                    },
                    {
                        direction: "None"   # 保持为空
                        mode: "NoPress"
                    }
                );
            };
        },
        {
            cid: 0x52;  #  Middle MButton
            action =
            {
                type: "Gestures";
                gestures: (
                    {
                        direction: "Up";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";     # 剪贴板
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_V"];
                        };
                    },
                    {
                        direction: "Down";
                        mode: "OnRelease";
                        action =
                        {
                            type = "Keypress";    # 微信
                            keys: ["KEY_LEFTCTRL", "KEY_LEFTALT", "KEY_W"];
                        };
                    },
                    {
                        direction: "Left";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";     # UOS AI
                            keys: ["KEY_LEFTMETA", "KEY_C"];
                        };
                    },
                    {
                        direction: "Right";
                        mode: "OnRelease";
                        action =
                        {
                            type: "Keypress";     # UOS AI talk
                            keys: ["KEY_LEFTCTRL","KEY_LEFTMETA", "KEY_C"];
                        }
                    },
                    {
                        direction: "None"    # 保持为空
                        mode: "NoPress"
                    }
                );
            };
        }
    );
}
);


 

参考

热心朋友技术分享

segmentfault.com/a/1190000039985213

blog.csdn.net/qq_41529751/article/details/130674959

blog.csdn.net/weixin_43698781/article/details/124335968

兼容设备

https://github.com/PixlOne/logiops/blob/main/TESTED.md

Linux 按键布局

https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h

鼠标按键CIDS 定义

https://github.com/PixlOne/logiops/wiki/CIDs

配置文件举例

https://github.com/PixlOne/logiops/blob/main/logid.example.cfg