キーボード入力中はタッチパッドを無効にする

Last-modified: 2018-10-07 (日) 19:50:10

結論から(libinput編)

  • まず、xinputコマンドでタッチバッドのIDを調べます。
    入力例
    $ xinput
    ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
    ⎜   ↳ ELAN0903:00 04F3:3051 Touchpad          	id=9	[slave  pointer  (2)]
    ⎜   ↳ ETPS/2 Elantech Touchpad                	id=11	[slave  pointer  (2)]
    ⎜   ↳ lircd-uinput                            	id=12	[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)]
        ↳ Power Button                            	id=7	[slave  keyboard (3)]
        ↳ Front camera: Front camera              	id=8	[slave  keyboard (3)]
        ↳ AT Translated Set 2 keyboard            	id=10	[slave  keyboard (3)]
        ↳ lircd-uinput                            	id=13	[slave  keyboard (3)]
    この場合は、IDは11だとわかります。
     
  • 次にタッチパッドのIDを引数にして、xinput list-props タッチパッドのID を実行します。
    実行例
     $ xinput list-props 11
     Device 'ETPS/2 Elantech Touchpad':
    	  Device Enabled (116):	1
    	  Coordinate Transformation Matrix (118):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    	  Device Accel Profile (246):	1
    	  Device Accel Constant Deceleration (247):	2.500000
     	  Device Accel Adaptive Deceleration (248):	1.000000
    	  Device Accel Velocity Scaling (249):	12.500000
    	  Synaptics Edges (250):	96, 2308, 67, 1182
    	  Synaptics Finger (251):	1, 1, 0
    	  Synaptics Tap Time (252):	180
    	  Synaptics Tap Move (253):	119
    	  Synaptics Tap Durations (254):	180, 180, 100
    	  Synaptics ClickPad (255):	0
    	  Synaptics Middle Button Timeout (256):	75
    	  Synaptics Two-Finger Pressure (257):	282
    	  Synaptics Two-Finger Width (258):	7
    	  Synaptics Scrolling Distance (259):	54, 54
    	  Synaptics Edge Scrolling (260):	1, 0, 0
    	  Synaptics Two-Finger Scrolling (261):	1, 0
     (後略)
     
    この場合、タッチパッドのドライバは、Synapticsが使われていることがわかります。
    ただ、Synapticsは、メンテナンスモードに移行しており、今後のアップデートはないそうですので、ここでは代わりにlibinputを使うように設定します。
    (ドライバがsynapticsの場合での設定方法はすみませんが、他を当たってください。synapticsの方がいろいろ細かく設定ができるようなので、そちらを使用したいケースもあると思います。大事なのは、自分のパソコンではどのドライバを使っているか把握していることです。)
     
  • 次のようなファイルを作成して、「90-libinput.conf」(注意)という名前で保存します。
     Section "InputClass"
             Identifier "libinput touchpad catchall"
             MatchIsTouchpad "on"
             MatchDevicePath "/dev/input/event*"
             Driver "libinput"
             Option "Tapping" "True"
             Option "TappingDrag" "True"
             Option "DisableWhileTyping" "True"
     EndSection
    この例では、オプションで、タップとタップからのドラッグとタイピング中の(タッチパッドの)使用不能の3つの機能をを有効にしています。
     
  • 作成した設定ファイルを /etc/X11/xorg.conf.d フォルダに保存します(管理者権限必要)。
    /etc/X11/xorg.conf.d フォルダがない場合は、管理者権限で作成します。
     $ sudo mkdir /etc/X11/xorg.conf.d
     

注意点

  • libinput は多分インストール済みになっていると思いますが、未インストールの場合は、各ディストーションの作法で手動でインストールしましょう。
  • ファイル名「90-libinput.conf」の数字は、大きいほど優先されます(後から読み込まれる)。
  • ファイル名「90-libinput.conf」の「libinput」の部分は自分で分かれば、ぶっちゃけなんでもいいです。
    (ファイル内の「Driver "libinput"」を変えてはいけません。念のため)

/etc/X11/xorg.conf.d と /usr/share/X11/xorg.conf.d の使い分けについて

  • 大雑把に言うと /usr/share/X11/xorg.conf.d はもともとある設定ファイルの置き場(従って、勝手にファイルを置いたり、削除したり、書き換えたりしてはいけない)で、後から追加したり、元のファイルを修正したものは、/etc/X11/xorg.conf.d に置くようになっているようです。
  • 私が試して見た限りでは、/etc/X11/xorg.conf.d の方が優先されているみたいです。
     
    設定ファイルの優先度
    ファイル名の数字小さい(例10)ファイル名の数字大きい(例90)
    /usr/share/X11/xorg.conf.d最小
    /etc/X11/xorg.conf.d最大
     

参考にしたサイト

https://iberianpig.github.io/posts/2018-07-15_disable_while_typing/
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/6/html/deployment_guide/s2-x-server-config-xorg.conf.d
https://wiki.archlinux.jp/index.php/Libinput