2011-02-15
タッチパッドの有効無効を一発で@Ubuntu10.04
やってみよう
まず、入力デバイスを出力
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Microsoft Microsoft IntelliMouse® Optical id=11 [slave pointer (2)] ⎜ ↳ Macintosh mouse button emulation id=14 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)] ...(略)...
この SynPS/2 Synaptics TouchPad というのがタッチパッドらしい。
念のため、設定できるプロパティを出力。
$ xinput watch-props 'SynPS/2 Synaptics TouchPad'
Device Enabled (121): 1 Device Accel Profile (244): 0 Device Accel Constant Deceleration (245): 1.000000 Device Accel Adaptive Deceleration (247): 1.000000 Device Accel Velocity Scaling (248): 10.000000 ...(略)...
Device Enabled があるのを確認。
テストしてみる
無効
$ xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Device Enabled' 0
あるいは id 指定で
$ xinput set-prop 13 'Device Enabled' 0
恐る恐る、タッチパッドをペタペタしてみます ... わーい、無効になったー(∩´∀`)∩
状態をチェックしてみると
$ xinput list 'SynPS/2 Synaptics TouchPad'
SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)] This device is disabled Reporting 3 classes: Class originated from: 13 Buttons supported: 12 ...(略)...
ちゃんと This device is disabled になっています。
んで、再び有効にしてみる
$ xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Device Enabled' 1
or
$ xinput set-prop 13 'Device Enabled' 1
もう一度、ペタペタしてみます ... こいつ、う、動くぞ!!
トグルさせる
このスクリプトを ~/bin あたりのパスが通っている場所に touchpad-on-off とか言うファイル名で保存して
実行権限を付加
$ chmod u+x ~/bin/touchpad-on-off
CompizConfig Settings Manager で Super + Ctrl + t あたりに touchpad-on-off を割り当てる。
これで快適タッチパッドライフがおくれそうです(´∀`*)
参考
先人の努力に感謝
Gist 埋め込みテスト
Gist 側
上部の Embed All Files: の show embed をクリックしたとき
<script src="https://gist.github.com/827273.js"> </script>
コード部の右上 embed をクリックしたとき
<script src="https://gist.github.com/827273.js?file=touchpad-on-off.sh"></script>
これを次のようにして、はてなダイアリーへ埋め込む
><script src="https://gist.github.com/827273.js"></script><
テステス
*1:コードは Gist に置いてます。見れない方はコチラ https://gist.github.com/827273
*2:コードは Gist に置いてます。見れない方はコチラ https://gist.github.com/827273