Debian

禁用滑鼠按鈕(羅技 M720 鐵人三項)

  • June 20, 2021

我的滑鼠上有一個按鈕,我無法禁用。它就在我的拇指旁邊,我一直不小心點擊它。它會觸發某種 alt+tab 功能,非常煩人!

這是我的 xinput 輸出:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech M720 Triathlon                   id=11   [slave  pointer  (2)]
⎜   ↳ Wacom Pen and multitouch sensor Finger touch  id=13   [slave  pointer  (2)]
⎜   ↳ Wacom Pen and multitouch sensor Pen stylus    id=14   [slave  pointer  (2)]
⎜   ↳ Elan Touchpad                             id=15   [slave  pointer  (2)]
⎜   ↳ Elan TrackPoint                           id=16   [slave  pointer  (2)]
⎜   ↳ Wacom Pen and multitouch sensor Pen eraser    id=20   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
   ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
   ↳ Power Button                              id=6    [slave  keyboard (3)]
   ↳ Video Bus                                 id=7    [slave  keyboard (3)]
   ↳ Sleep Button                              id=8    [slave  keyboard (3)]
   ↳ Apple, Inc Apple Keyboard                 id=9    [slave  keyboard (3)]
   ↳ Apple, Inc Apple Keyboard                 id=10   [slave  keyboard (3)]
   ↳ Integrated Camera: Integrated C           id=12   [slave  keyboard (3)]
   ↳ AT Translated Set 2 keyboard              id=17   [slave  keyboard (3)]
   ↳ ThinkPad Extra Buttons                    id=18   [slave  keyboard (3)]
   ↳ Logitech M720 Triathlon                   id=19   [slave  keyboard (3)]

這是xinput test 11輸出,當我點擊按鈕時:

key press   37 
key press   64 
key press   23 
key release 23 
key release 64 
key release 37

編輯:xev 輸出

KeyPress event, serial 40, synthetic NO, window 0x4e00001,
   root 0x16b, subw 0x0, time 3927972, (-192,136), root:(679,596),
   state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
   XLookupString gives 0 bytes: 
   XmbLookupString gives 0 bytes: 
   XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4e00001,
   root 0x16b, subw 0x0, time 3927980, (-192,136), root:(679,596),
   state 0x14, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
   XLookupString gives 0 bytes: 
   XmbLookupString gives 0 bytes: 
   XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4e00001,
   root 0x16b, subw 0x0, time 3927988, (-192,136), root:(679,596),
   state 0x1c, keycode 23 (keysym 0xff09, Tab), same_screen YES,
   XLookupString gives 1 bytes: (09) " "
   XmbLookupString gives 1 bytes: (09) "   "
   XFilterEvent returns: False

有沒有辦法在啟動時忽略設備 ID 11?如果是這樣,如何以及如何確保它在啟動時不會忽略其他內容?我可以忽略 xinput 中的這些按鍵,但是我的鍵盤將無法再按這些按鍵。

滑鼠本身既是滑鼠又是鍵盤。您可以使用以下方法禁用鍵盤部分:

$ xinput disable 19

通常您會使用設備名稱“Logitech M720 Triathlon”作為最後一個參數,但滑鼠使用相同的名稱,因此您必須從處理列表中獲取數字。就像是:

$ xinput disable $(xinput --list | grep M720.*keyboard | sed -E 's/.*id=([0-9]+).*/\1/g')

要在 Xfce 會話開始時設置它,您可以檢查這個

引用自:https://unix.stackexchange.com/questions/652888