LoginSignup
6
5

More than 3 years have passed since last update.

Ubuntu 18.04.* LTS で Kensington Expert Mouse Trackball(または Slimblade) を使う

Last updated at Posted at 2018-10-17

この記事はなに?

Ubuntu 18.04.2 LTS で Kensington のトラックボールの設定(左上のボタンをクリックで『戻る』、右上のボタンをクリックで『進む』)をするだけの記事。

今、あまり時間がないので、走り書きのまま投稿してしまいます。

やり方

01.デバイスを探す

lsusb で USB機器の一覧からトラックボールをgrepしてID(わたしの場合は 047d:1020 がそれに当たる)を探してどっかにメモる。

$ lsusb|grep -i ken
-------------------
Bus 001 Device 006: ID 047d:1020 Kensington Expert Mouse Trackball
-------------------

02.xorg の設定ファイルを作成する

/usr/share/X11/xorg.conf.d/XX-kensington.conf
※XX : 00〜99 の間で同ディレクトリ内の他のファイルと重複しない番号でファイル名を設定してください
ファイル名さえ重複していなければ行頭の番号は重複していても問題ありません(2020/02/09 訂正)

↓私の場合はこんな感じ。

Expert Mouse の場合

$ sudo vim /usr/share/X11/xorg.conf.d/30-kensington.conf
-------------------
Section "InputClass"
    Identifier  "Kensington Expert Mouse"
    MatchUSBID  "047d:1020"
    Driver      "libinput"
    MatchDevicePath "/dev/input/event*"
    Option      "ButtonMapping" "1 8 3 4 5 6 7 9 2"
EndSection
-------------------

Slimblade の場合

$ sudo vim /usr/share/X11/xorg.conf.d/30-kensington-slim.conf
-------------------
Section "InputClass"
    Identifier  "Kensington SlimBlade Trackball"
    MatchUSBID  "047d:2041"
    Driver      "libinput"
    MatchDevicePath "/dev/input/event*"
    Option      "ButtonMapping" "1 8 3 4 5 6 7 9 2"
EndSection
-------------------

参考URL

『進む』と『戻る』に対応するボタンの番号について:
https://wiki.archlinux.jp/index.php/%E5%85%A8%E3%81%A6%E3%81%AE%E3%83%9E%E3%82%A6%E3%82%B9%E3%83%9C%E3%82%BF%E3%83%B3%E3%82%92%E5%8B%95%E4%BD%9C%E3%81%95%E3%81%9B%E3%82%8B#%E8%A6%AA%E6%8C%87%E3%83%9C%E3%82%BF%E3%83%B3_-_%E9%80%B2%E3%82%80%E3%81%A8%E6%88%BB%E3%82%8B

ボタンの番号の調べ方について:
https://qiita.com/Lirimy/items/c996163cc2540f603ea9

ボタンの並びを変えるだけで実現可能であることについて:
http://emonkak.hatenablog.com/entry/2017/05/30/141413

(2019/04/21 追記)imwheelの設定ファイル名について:
http://manpages.ubuntu.com/manpages/bionic/man1/imwheel.1.html#files

imwheel

スクロールする行数の指定などを設定するパッケージ。
一度のスクロールで移動する行数を増やしたい方のみ、こちらのパッケージが必要になります。

$ sudo apt install -y imwheel
$ vi  ~/.imwheelrc
".*"
None,      Up,   Button4, 16
None,      Down, Button5, 16
$ imwheel --kill --buttons "4 5"

自動起動設定

実行するコマンドは下記の通り

imwheel --kill --buttons "4 5"

--buttons "4 5"というオプションがないとブラウザバックとかが効かなくなる。

2019/04/21 追記: imwheel の設定ファイル名について

ubuntu 18.04 LTS では .imwheel でも動いていたが、
ubuntu 18.04.2 LTS では imwheel 実行時に下記の info が表示され、設定が反映されなかった。

$ imwheel --kill --buttons "4 5"
INFO: imwheel started (pid=1737)
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
〜長いので中略〜
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2

そこで、ググったら imwheel の設定ファイル名は .imwheel ではなく .imwheelrc が正しい物であることが判った。

もし、混乱を与えてしまった方、いらっしゃいましたら、申し訳ありませんでしたm(_ _)m

参考:
Ubuntu Manpage imwheel - a mouse wheel and button interpreter for X Windows
http://manpages.ubuntu.com/manpages/bionic/man1/imwheel.1.html#files

以下、表示されたinfoの全文

$ imwheel --kill --buttons "4 5"
INFO: imwheel started (pid=3012)
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Left
Unrecognized wheel action in config. Ignoring action.
Right
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
Unrecognized wheel action in config. Ignoring action.
Thumb1
Unrecognized wheel action in config. Ignoring action.
Thumb2
$
6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5