安装包xautomation
,我们需要命令xte
sudo apt-get install xautomation
Run Code Online (Sandbox Code Playgroud)安装包x11-utils
,我们需要命令xev
sudo apt-get install x11-utils
Run Code Online (Sandbox Code Playgroud)检查两个鼠标按钮的代码。
xev
在终端中启动命令:
xev
Run Code Online (Sandbox Code Playgroud)在新窗口中移动鼠标
按下额外的鼠标按钮
就我而言,请注意输出button 8
和button 9
:
ButtonRelease event, serial 36, synthetic NO, window 0x2e00001,
root 0x233, subw 0x0, time 9222464, (94,21), root:(1774,85),
state 0x10, button 8, same_screen YES
ButtonPress event, serial 36, synthetic NO, window 0x2e00001,
root 0x233, subw 0x0, time 9223854, (94,21), root:(1774,85),
state 0x10, button 9, same_screen YES
Run Code Online (Sandbox Code Playgroud)编辑您的xbindkeys
配置,例如:
nano ~/.xbindkeysrc
Run Code Online (Sandbox Code Playgroud)
并添加以下几行
"xte 'key Home'"
b:9
"xte 'key End'"
b:8
Run Code Online (Sandbox Code Playgroud)
用您的输出数量替换b:8
和b:9
xev
从 man xte
key k
Press and release key k
keydown k
Press key k down
keyup k
Release key k
Run Code Online (Sandbox Code Playgroud)杀死所有kbindkeys
进程
killall xbindkeys
Run Code Online (Sandbox Code Playgroud)重新启动xbindkeys
您的配置,例如:
xbindkeys -f ~/.xbindkeysrc
Run Code Online (Sandbox Code Playgroud)