我有一个 Microsoft Sidewinder X8 鼠标,我希望使用8forShift和9for Control. 有人可以告诉我怎么做吗?
首先安装xdotool
sudo aptitude install xdotool
Run Code Online (Sandbox Code Playgroud)
然后,您可以创建一个脚本来模拟Ctrl按键。打开 gedit 并复制粘贴以下内容:
#! /bin/bash
xdotool keydown ctrl
while [MOUSEKEYDOWN == 1]; do #TODO change the while test.
sleep 30
#decrease sleep if script doesn't react fast enough on releasing the key,
#increase sleep if the computer uses to many CPU when pressing the button.
done
xdotool keyup ctrl # Lift the key back up after no button is pressed.
Run Code Online (Sandbox Code Playgroud)
我不是一个优秀的 bash 程序员。我需要寻找一种方法来确定您的按钮是否按下,并且我可能有(多个)语法错误,但我想 bash 程序员会明白这一点。
如果有人修复了脚本,请将其保存在 ctrl.sh 下并使其可执行
chmod +x ctrl.sh
Run Code Online (Sandbox Code Playgroud)
然后,正如 nathwill 所说,进入系统 -> 首选项 -> 键盘。添加自定义命令,选择添加 ~/ctrl.sh 命令并按鼠标按钮作为快捷键。
这应该可以做到。