配置Trackpoint的中鍵滾輪功能

此頁由 Linux Wiki用戶Chenxing 於 2012年12月18日 (星期二) 08:00 的最後更改。 在lzhngU khOsderftgyh的工作基礎上。

出自Linux Wiki

提示:此文已超过 11 年(4140 天)未更新,如发现内容过时或有误,欢迎改进:)

本文介紹在多種Linux發行版中設置Trackpoint的方法。[1]

Trackpoint指的是Thinkpad筆記本上的指點桿(又常被稱為紅點)。

目錄

即時設置

目前使用xinput設置紅點行為可以立即生效,方法為直接執行如下命令:

xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 8 200
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

把這些代碼放在~/.xprofile中,可以在進入X時讓命令自動執行。

系統設置

各發行版的設置方法稍有不同,下面分別介紹。應注意隨意X版本的變化,配置方法一直在發生變化,目前推薦使用上章中的方法。

為避免出現意外,請先備份你的/etc/X11/xorg.conf
# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak.trackpoint

下面分別介紹不同發行版中的配置方法。

較新的發行版

Ubuntu 8.10、Fedora 10、Archlinux等較新的發行版中,鍵盤、鼠標不再由X服務器而是HAL管理[2]。但目前Debian、Mandriva等暫不在此列(請參見後面的設置方法)。

首先,創建文件/etc/hal/fdi/policy/mouse-wheel.fdi,內容為:

<?xml version="1.0" encoding="UTF-8"?>
<match key="info.product" string="TPPS/2 IBM TrackPoint">
 <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.ZAxsisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
</match>
Note.gif
注意:
2009年12月底的Archlinux中hal的設備名有變化,請將TPPS/2 IBM TrackPoint改為PS/2 Generic Mouse。如果不能名稱,可使用lshal | grep input.product判斷。

完成更改後,重新啟動計算機(或重啟hal服務,並註銷、重新登錄)。如果一切正常,現在你就可以使用“紅點”了。

Note.gif
注意:
僅僅註銷後重新登錄不能使更改生效,請務必按上述介紹操作。

由於對應的新驅動(xserver-xorg-input-evdev)存在一些bug,完成上述配置後Ubuntu系統可能在一些情況下仍然無法使用滾輪,可以嘗試自行編譯打過補丁的驅動,步驟如下:

wget http://launchpadlibrarian.net/19254960/preinit.diff
sudo apt-get install build-essential
sudo apt-get build-dep xserver-xorg-input-evdev
apt-get source xserver-xorg-input-evdev
cd xserver-xorg-input-evdev-2.0.99+git20080912
patch -p1 < ../preinit.diff
./autogen --prefix=/usr
make
sudo make install

Debian Lenny/Sid或openSUSE

/etc/X11/xorg.conf中,找到Configured Mouse並將其所在的Section做如下修改:

Section "InputDevice"
   Identifier  "Configured Mouse"
   Driver      "mouse"
   Option      "CorePointer"
   Option      "Device"              "/dev/input/mice"
   Option      "Protocol"            "ExplorerPS/2"
   Option      "Emulate3Buttons"     "true"
   Option      "Emulate3TimeOut"     "50"
   Option      "EmulateWheel"        "on"
   Option      "EmulateWheelTimeOut" "200"
   Option      "EmulateWheelButton"  "2"
   Option      "YAxisMapping"        "4 5"
   Option      "XAxisMapping"        "6 7"
   Option      "ZAxisMapping"        "4 5"
EndSection

其它發行版

其它發行版,如Fedora 9及以前的版本,或其它在/etc/X11/xorg.conf中沒有Configured Mouse小節的發行版中,修改的基本思路都是在/etc/X11/xorg.conf中有關鼠標一項如上設置即可,並注意更改ServerLayout部分(如果有的話)的設備名稱。下面以Fedora 9為例介紹:

Fedora中,/etc/X11/xorg.conf中沒有Configured Mouse一項,需要添加:

# ServerFlags一节对Fedora 9来说是必要的[3]
Section "ServerFlags"
       Option  "AutoAddDevices"        "false"
EndSection
Section "InputDevice"
      Identifier  "Configured Mouse"
      Driver      "mouse"
      Option      "CorePointer"
      Option      "Device"              "/dev/input/mice"
      Option      "Protocol"            "ExplorerPS/2"
      Option      "Emulate3Buttons"     "on"
      Option      "Emulate3TimeOut"     "50"
      Option      "EmulateWheel"        "on"
      Option      "EmulateWheelTimeOut" "200"
      Option      "EmulateWheelButton"  "2"
      Option      "YAxisMapping"        "4 5"
      Option      "XAxisMapping"        "6 7"
      Option      "ZAxisMapping"        "4 5"
EndSection

Section "InputDevice"
     Identifier	"Synaptics Touchpad"
     Driver		"synaptics"
     Option		"SendCoreEvents"	"true"
     Option		"Device"		"/dev/psaux"
     Option		"Protocol"		"auto-dev"
     Option		"HorizScrollDelta"	"0"
     Option		"SHMConfig"			"on"
EndSection
Section "ServerLayout"
中,去掉(如果有的話)
 InputDevice    "Synaptics" "CorePointer"

加入:

InputDevice    "Configured Mouse"
InputDevice	"Synaptics Touchpad"

配置完成,重新啟動X就可以看到效果。

Firefox中水平滾動的配置

Firefox中垂直滾動是沒有問題的,但是當試圖水平滾動時可能執行的是前進、後退操作。如果要修正,請在地址欄中輸入

about:config 

回車。更改下列設置:

mousewheel.horizscroll.withcontrolkey.action = 3;
mousewheel.horizscroll.withcontrolkey.numlines = 1; 
mousewheel.horizscroll.withcontrolkey.sysnumlines = true;

mousewheel.horizscroll.withnokey.action = 0;
mousewheel.horizscroll.withnokey.numlines = 1;
mousewheel.horizscroll.withnokey.sysnumlines = true;
 
mousewheel.horizscroll.withshiftkey.action = 1;
mousewheel.horizscroll.withshiftkey.numlines = 1;
mousewheel.horizscroll.withshiftkey.sysnumlines = true;

你也可以直接做如下更改(僅僅避免了由中鍵導致的前進、後退功能):

mousewheel.horizscroll.withnokey.action = 0;

Opera中滾動的設置

Opera在水平滾動時也可能發生“前進”、“後退”等操作,修正方法為:

菜单中:工具->首选项->高级->快捷键->鼠标设置->Opera Standard->编辑

在彈出的窗口中:

Application->Button6->删除->Button7->删除

確定後,選中Opera Standard(已修改),一路確定即可。

相關文章

Firefox、Opera中使用Thinkpad導航鍵

參考資料

  1. thinkwiki.org上對Trackpoint配置的介紹
  2. Scrolling with the Thinkpad's TrackPoint in Ubuntu 8.10 Intrepid
  3. Fedora9環境中的配置方法

本文对您有帮助?分享给更多朋友!

反馈与讨论

发现文档不全面、有错误却没时间编辑文档?想分享自己的经验或见解?欢迎在此留言、讨论。
简体繁体转换