2025-12-15

Linux Ubuntu 利用滑鼠側鍵

#安裝工具
 sudo apt install xbindkeys xdotool

#點擊滑鼠側鍵,通常是button 8 或 button 9
xev | grep button

#產生設定檔
xbindkeys --defaults > ~/.xbindkeysrc

#編輯.xbindkeysrc,範例如下:

#button 8 模擬中鍵
"xte 'mouseclick 2'"
b:8 + Release

#button 9 輸出字串
"xdotool type 123456"
b:9 + Release

#button 9 模擬 ctrl+c
"xdotool key ctrl+c"
b:9 + Release

#button  8 模擬 ctrl+v
"xdotool key ctrl+v"
b:8 + Release

#重啟 xbindkeys 載入設定,記得將xbindkeys加到開機啟動
killall xbindkeys && xbindkeys

沒有留言:

張貼留言