如何将 Ctrl/Shift 映射到鼠标的拇指按钮?

6 mouse hardware

我有一个 Microsoft Sidewinder X8 鼠标,我希望使用8forShift9for Control. 有人可以告诉我怎么做吗?

san*_*d17 2

首先安装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 命令并按鼠标按钮作为快捷键。

这应该可以做到。


nat*_*ill 0

系统\xe2\x86\x92首选项\xe2\x86\x92键盘快捷键可让您将按键/按钮映射到命令;如果这不起作用,xbindkeys那就是另一个很棒的键映射应用程序。

\n