[English follows]

先日、「[Linux] マウスホイールの加速ができた! (PoC)」で触れたプログラムの公開の要望を頂き、検討したところ、不足な点や問題はあるものの、いろいろやって遅くなるよりは、とりあえず使って試して頂くほうがいいと考えたので、今私が使っている版をV0.1として公開します。

より多くの方にお試し・使用して頂ければと思い、日英両方で記載します。日本語版を先に("[English follows]"や"[Ja]"の後や"/"の前に)書き、英語版は"[English]"や"[En]"や"/"の後に書きます。

(2020/4/16 8:16) NixNote2などでの動作の改善や、Cコンパイラがない・コンパイルしたくない場合などにxdotoolを使う機能などを追加した、V0.2を公開しました。

[English]

A few days ago, I have been asked to publish my own program "acc-wheel" which accelerates Linux/X11's mouse wheel (it has been introduced in my past article "[Linux] Succeeded in accelerating mouse wheel! (PoC)" (written in Japanese)). Although it is not complete (has some problems and limitations), it is better to publish now and made it evaluated and used than continue working on and being "too late". So, I would like to publish current version of the software as "V0.1".

Because I would like the software to be evaluated or used globally, this article is written in both Japanese and English. Japanese descriptions are first (after "[English follows]" or "[Ja]", or before "/"), and then English ones (after "[English]", "[En]", or "/").

(2020/4/16 8:16) Released V0.2, which improves behavior on some apps. (eg. NixNote2), can use xdotool for envs. without C compiler, or for who don't want to compile, and other improvements.

1. ソフトウェアの説明 / Software description

1.1 概要 / Abstruct

[English follows]

acc-wheelは、X Window System (X11)の動作しているデスクトップLinuxでWindowsやmwillacOSのようなマウスホイールの加速を実現します。これは単にホイールの回転量を常に数倍にする(例: ×2)のではなく、ホイールを回転させる速度に応じて回転量を増やす「真の加速」なので、通常の使用時(= ホイールをゆっくり回す場合)に不都合は起こりません。

また、ドライバなどの特別なプログラムでなく通常のプログラムなので、起動するだけで手軽に使えます。

ただし、実行するユーザーがマウスのイベントデバイスを読み出せるように、あらかじめユーザー情報を設定する必要があります。また、V0.1では、マウスイベントを発生させるためのプログラムのコンパイルが必要です。

[English]

acc-wheel implements mouse wheel acceleration as in Windows or macOS on desktop Linux systems running  X Window System (X11). This is not simply multiplying wheel rotation with fixed number (ie. ×2), but a "true acceleration", which increases the amount of rotation according to the speed of rotating speed of the wheel. So, inconvenience never happens in ordinary usage (ie. when rotating the wheel slowly).

In addition, because this is an ordinary program (not special one like device driver), you can use it very handy - just start it.

Notes: Before using, you have to make your user account to be able to read mouse's event device. And, V0.1 requires compilation of an accompanied C program which generates mouse events.

1.2 動作 / Opeation

[English follows]

acc-wheelの処理概要は以下のとおりです。

  1. マウスのイベントデバイス(例: "/dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse")からイベントを読み出す。
  2. ホイールイベントだった場合、イベントの発生速度(= ホイールの回転速度)を求める。
  3. 速度が高速だった場合、追加のホイールイベントを発生させる(→ ホイールの「加速」になる)。
    • 追加のイベントの量(= 加速の度合い)は以下の3つのモードで選択可能。
      • S (ステップ)モード: イベントの発生速度がとても速い場合、より多くの追加イベントを発生させる。 (デフォルト)
      • L (比例加速)モード: イベントの発生速度に比例した追加イベントを発生させる。
      • LS (遅目の比例加速)モード: Lモードと同様だが、少な目の追加イベントを発生させる。
  4. 1に戻る。

[English]

Overview of acc-wheel's process is as follows:

  1. Read events from mouse's event device (eg. "/dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse").
  2. If the events are from wheel, calculate event generation speed(= wheel rotation speed).
  3. If the speed is fast, generate additional wheel events (→ become "acceleration" of wheel rotation).
    • Amount of added wheel events (= amount of acceleration) can be chosen in the following three modes:
      • S (Step) mode: If the speed is very fast, generate more events.
      • L (Linear) mode: Generate events proportionally to the speed.
      • LS (Slow linear) mode: Like L mode, but generate less events.
  4. Go to 1.

1.3 環境 / Environment

1.3.1 対応・要求環境 / Supported/required environment

  • X11の動作しているLinuxデスクトップ / Desktop Linux running X11.
  • マウスがイベントデバイスになっていること("/dev/input/by-id/usb-マウス名-event-mouse"がある)。 / The mouse is an event device (ie. Mouse's event device exists as "/dev/input/by-id/usb-Mouse-name-event-mouse".)
  • 実行するユーザーがマウスのイベントデバイスを読み出せること。 / The user has a read permission to the mouse event device.

1.3.2 必要なソフトウェア / Required software

  • PHP言語 / PHP language processor
    • 例: Ubuntu系の場合、php-7.3, php7.3-cliパッケージ / Eg.: php-7.3 and php7.3-cli packages for Ubuntu
  • X11の開発パッケージ / X11 dev. package
    • 例: Ubuntu系の場合、libx11-dev / Eg.: libx11-dev for Ubuntu
    • 使用X11ライブラリ / X11 libraries used: libX11, libXtst, libXext
  • [V0.2: なくても可 / V0.2: Not mandatory] Cプログラム(gen-mouse-ev.c)のコンパイルのため、gccまたは他のCコンパイラ。 / gcc or other C compilers (to compile accompanied C program: gen-mouse-ev.c).
  • [V0.2 のみ / V0.2 only] xdotoolコマンド (マウスイベントを発生させるためにgen-mouse-ev.cの代わりに使う場合) / xdotool command (when using it to generate mouse events instead of gen-mouse-ev.c)
    • 例: Ubuntu系の場合、xdotoolパッケージ / Eg.: xdotool package for Ubuntu

1.3.3 開発・確認環境 / Developed and tested env.

Linux Mint 18.3 Xfce

1.3.4 ユーザーによる動作確認済み環境 / Reported working envs. by users

2. デモ動画 / Demo movie

Linux Mint XfceにてFirefoxブラウザでホイールを回転させた比較 / Comparison of rotating the wheel on a Firefox browser running on Linux Mint Xfce.

通常の場合(acc-wheelを起動させず)にホイールを速く回転させた場合 / Rotating the wheel fast in ordinary situation (without running acc-wheel).

 

acc-wheelをSモードで動かし、ホイールを遅く回転させた場合 / Running acc-wheel in S mode, rotating the wheel slowly.

 

acc-wheelをSモードで動かし、ホイールを速く回転させた場合 / Running acc-wheel in S mode, rotating the wheel fast.

 

acc-wheelをSモードで動かし、ホイールをとても速く回転させた場合 / Running acc-wheel in S mode, rotating the wheel very fast.

 

3. ダウンロード / Download

acc-wheel-0.2.1.tar (md5sum: 77aac373e8799d9b9374b4fac035f4d8)

(Old version: acc-wheel-0.1.tar (md5sum: ab8f590f11146b484741a1646bc4c2d8))

Releases also available on GitLab.

4. インストール手順 / Installation

[English follows]

4.1 標準的な手順 (特にUbuntu系の場合)

  1. 実行するユーザーがマウスのイベントデバイスを読めるようにする。 (例: ユーザーIDをマウスイベントデバイスのグループ(例: input)に追加する。)
    1. マウスイベントデバイスのパーミッションを確認する
      • 例: ls -lL /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse
      • crw-rw---- 1 root input 13, 68 4月 8 08:08 /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse
    2. デバイスがグループ(例: input)での読み出し可の場合、ユーザーID(例: user)をそのグループに追加する。
      • 例: sudo usermod -G input user
    3. Linux・デスクトップにログインし直す。
  2. acc-wheelの作業用のディレクトリを作るか既存のものに移動する。
    • : cd ~/work
  3. ダウンロード・展開する。 → ディレクトリ "acc-wheel"ができる。
    • :
      • [V0.1] wget -O - https://piulento.net/bsw/acc-wheel/acc-wheel-0.1.tar | tar xf -
      • [V0.2] wget -O - https://piulento.net/bsw/acc-wheel/acc-wheel-0.2.tar | tar xf -
  4. [V0.2では省略可] acc-wheelにchdirし、gen-mouse-ev.cをコンパイルする。 → マウスイベントを生成するプログラムgen-mouse-evができる。
    • : cd acc-wheel && gcc -o gen-mouse-ev gen-mouse-ev.c -lX11 -lXtst -lXext
  5. [V0.2のみ] マウスイベントを発生させるのにxdotoolを使う場合、xdotoolをインストールする。
    • 例: sudo apt-get install xdotool

[English]

4.1 Standard steps (ie. on Ubuntu systems)

  1. Enable your read access to your mouse event device (eg. add your user ID to mouse event device's group (eg. input)).
    1. Check mouse event device's permission.
      • Eg.: ls -lL /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse
      • crw-rw---- 1 root input 13, 68 4月 8 08:08 /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse
    2. If the device can be read by group (eg. input), add your id (eg. user) to the group.
      • Eg.: sudo usermod -G input user
    3. Re-login to the Linux/desktop.
  2. Make or choose a work dir. for acc-wheel and chdir to it.
    • Eg.: cd ~/work
  3. Download the archive and extract. → Dir. "acc-wheel" will be made.
    • Eg.:
      • [V0.1] wget -O - https://piulento.net/bsw/acc-wheel/acc-wheel-0.1.tar | tar xf -
      • [V0.2] wget -O - https://piulento.net/bsw/acc-wheel/acc-wheel-0.2.tar | tar xf -
  4. [V0.2: Not mandatory] Chdir to acc-wheel and compile gen-mouse-ev.c. → Program to generate mouse event "gen-mouse-ev" will be made.
    • Eg.: cd acc-wheel && gcc -o gen-mouse-ev gen-mouse-ev.c -lX11 -lXtst -lXext
  5. [V0.2 only] Install xdotool when using it to generate mouse events instead of gen-mouse-ev.
    • Eg.: sudo apt-get install xdotool

4.2 参考: ユーザーから頂いた情報 / Supp.: Information from users

4.2.1 Fedora31 Gnome3でのインストール / Installation on Fedora31 Gnome3 (2020/4/14: 匿名 / anonymous)

  • 以下のパッケージを追加でインストールする。 / Install additional packages as the following steps:
    • sudo dnf install libXtst-devel
    • sudo dnf install php-cli
    • sudo dnf install php-process
  • マウスのナチュラルスクロールの設定はoffにする必要あり。 / Mouse's "natural scrolling" has to be disabled.

5. 使用手順 / Usage

  1. acc-wheel.phpを起動する。 / Run acc-wheel.php.
    • 書式 / Synopsis: php acc-wheel.php [-m S|L|LS] [-d[v]] [-v|-q] [-xdt] [-h] [mouse-event-dev-name] (-xdt, -h: V0.2のみ / V0.2 only)

      • -m: 加速モード / Wheel acceleration mode
        • S: ステップ加速モード (デフォルト) / Step acceleration mode (default)
          • [Ja] ホイールの回転速度がとても速い場合、より多く加速する。
          • [En] If the wheel speed is very fast, acceleration becomes large.
        • L: 比例加速モード / Linear acceleration mode
          • [Ja] ホイールの回転速度に比例した追加イベントを発生させる。
          • [En] Accelerate proportionally to the wheel speed.
        • LS: 遅目の比例加速モード / Slower linear acceleration mode
          • [Ja] Lモードと同様だが、少な目の追加イベントを発生させる。
          • [En] Like L mode, but smaller acceleration.
      • -d, -dv: デバッグモード / Debug mode (-dv: より多くの情報を出力する / more verbose)
      • -v: 冗長モード (デフォルト) / Verbose mode (default)
      • -q: 非冗長モード / Quiet mode
      • [V0.2] -xdt: マウスイベントの発生させるのにgen-mouse-evでなくxdotoolを使う。 / Use xdotool instead of gen-mouse-ev to generate mouse events.
      • [V0.2] -h: 使用法を表示する。 / Show usage.
      • mouse-event-dev-name:
        • [Ja] マウスイベントデバイスのパス (例: /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse)
          • 指定しない場合、自動でマウスを検索し、最初のものが使用される。
        • [En] Path of mouse event device (Eg.: /dev/input/by-id/usb-Microsoft_Comfort_Mouse_6000-event-mouse)
          • If not specified, system's mice are searched automatically and the first one will be used.
    • 実行例 / Example: php acc-wheel.php < /dev/null>& /dev/null &
  2. マウスホイールを速く回転させると、ウインドウのスクロールが加速されます! / Scroll mouse wheel faster, and the window's scrolling speed will be accelerated!

参考: マウスイベント生成プログラム: gen-mouse-evの使い方 / Supp.: Usage of mouse event generation program: gen-mouse-ev

  • 書式 / Synopsis: gen-mouse-ev [mouse-button-syms...]
    • mouse-button-syms: 生成するマウスボタン記号(番号) / Mouse button symbols (numbers) to generate.
      • 1, 2, 3, ...: ボタン番号 / Button number
        • 4: ホイール上向き / Wheel up, 5: ホイール下向き / Wheel down
      • Sn: n (ms)スリープする / Sleep n (ms).
      • C: XSyncを実行する / Perform XSync.
      • 指定しない場合、マウスボタン記号を標準入力から取得する。 / If not specified, mouse button syms. are obtained from stdin.
        • ボタン記号と改行(\n)を入力して行く。 / Specify one button sym. per line. Each line ends with newline(\n).
        • 空行の場合はXSyncを実行する / When empty line entered, XSync is performed.
  • 実行例 / Example
    • ./gen-mouse-ev 4 C S200 4 :  ホイール上, XSync, スリープ200ms, ホイール上 / Wheel up, XSync, Sleep 200ms, Wheel up
    • echo -e "4\nC\nS200\n4" | ./gen-mouse-ev : 上と同じ(標準入力から読む) / Same as above (button syms. are read from stdin).

6. 調整 / Tweaks

  • 加速特性の調整 / Adjusting acceleration mode/rate.
    • acc-wheel.phpの-mオプションでモードを変える。 / Specify acc. mode with -m option of acc-wheel.php.
      • acc-wheel.phpの変数$wheel_acc_configsに各モードの加速パラメタが定義されている。 / Params. of each mode are defined in $wheel_acc_configs in acc-wheel.php.
  • ブラウザの「スムーススクロール」はoffにしたほうがいい。 / It 's better to disable browser's "smooth scroll".
  • うまく動かない場合、マウスのイベントデバイス(/dev/input/by-id/usb-マウス名-event-mouse)のモードを確認すること。 / If acc-wheel doesn't work, check the permission of mouse event device (/dev/input/by-id/usb-mouse-name-event-mouse).

7. 制限事項・既知の問題 / Limitations and known problems

  • 対応するマウスは1個だけ。 / Only one mouse is supported.
  • 加速されたホイールイベントが少し遅れて出ることがあり、思わぬ結果になることがある。 / Sometimes, generation of accelerated wheel events are delayed and unexpected behavior may occur.
  • アプリケーションによっては(例: NixNote2)、今ひとつ正常に動作しない。 / Some applications (eg. NixNote2) doesn't handle accelerated wheel events well. → V0.2で改善した。 / Improved on V0.2.
    • [Ja] [NixNote2, digiKam6] ホイールを速く回した時のスクロール量がおかしい(スクロールしない、変なところにジャンプする、もたつく)。
    • [En] [NixNote2, digiKam6] When wheel speed is very fast, scrolling amount is not right (eg. doesn't scroll, jump to unexpected loc., or scroll amount is very small).
  • [V0.2] [xdotoolを使用する場合: -xdt] 追加ホイールイベントを発生させるたびにxdotoolを起動するので効率が悪い(例: 負荷が少し重くなる)。 / [When using xdotool: -xdt] Because xdotool is invoked every time when generating additional wheel events, the process is not so efficient (eg. CPU load will be a little bit heavy).
    • xdotoolに標準入力からコマンドを指定しても動作しないため。 / Because xdotool does not seems to execute commands read from stdin.

8. TODOs

  • 不具合修正 / Fix problems.
  • 加速パラメタの調整を容易にする。 / Make adjustment of acc. param. easy.
  • その他のさまざまな改良。。。 / And other various improvements...
  • インストーラーやMakefileを作る。 / Make an installer (and Makefile).
  • ☑ GitHubやGitLabなどで公開する。 / Publish on GitHub or GitLab. → 試しにGitLabで公開した。 / Experimentally published on GitLab.

9. ライセンス / License

[English follows]

このソフトウェアはMITライセンスで公開します。正式なドキュメントができるまでは、この投稿も本ソフトウェアの一部とします。

[English]

This software is published under the MIT license. Until formal documents are available, this article should be treated as part of the software.

ライセンス文書 / License text

Copyright 2018-2020 Butty PiuLento

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

10. サポート / Support

[English follows]

ご感想やインストールや使用上の問題などは、この投稿にコメントして下さい。可能な範囲で対応します。

[English]

Any comments would be appreciated, and if you have any trouble in installing and using acc-wheel, please comment to this post. I will support as possible.

11. 謝辞 / Acknowledgement

[English follows]

gen-mouse-ev.cで実行している、XTestでマウスホイールイベントを発生させるアイデアはBharathi Subramanianの"X11 Fake Mouse Events Generation using XTest Extension" (2010)より得ました。

[English]

Idea of issuing mouse wheel events using XTest (performed in gen-mouse-ev.c) was obtained from Bharathi Subramanian's "X11 Fake Mouse Events Generation using XTest Extension" (2010).

 

Mod. history (English only)

2020/4/14 9:40: 11. 謝辞 / Acknowledgement: Corrected "gen-mouse-ev.c" was old name ("send-mouse-ev.c").

2020/4/14 10:03: 1.3.4 ユーザーによる動作確認済み環境 / Reported working envs. by users, 4.2 参考: ユーザーから頂いた情報 / Supp.: Information from users: Added info. of Fedora31 Gnome3 from anonymous user.

2020/4/14 12:13: 5. 使用手順 / Usage: Added gen-mouse-ev's usage as supp.

2020/4/14 17:25: Experimentally published on GitLab.

2020/4/15 13:55: 1.3.2 必要なソフトウェア / Required software: Added php7.3-cli.

2020/4/15 14:21: 3. ダウンロード / Download: Added releases on GitLab.

2020/4/15 20:47: 制限事項・既知の問題 / Limitations and known problems: Added digiKam6 to incompat. apps. Fixed NixNote2's name.

2020/4/16 8:16: Released V0.2 and added the info. Deleted "V0.1" from the title.

2020/4/19 16:29: 3. ダウンロード / Download: Updated to V0.2.1

  •  0
  •  3
Keys:

2件のコメント

  1. 匿名:

    早速の公開ありがとうございます!
    記載通りの手順で無事使うことができました。
    期待通り動作しています。
    ありがとうございます。

    以下、簡単ですがメモを共有させていただきます。
    ---
    Fedora31 Gnome3
    追加で以下のパッケージをインストール。
    sudo dnf install libXtst-devel
    sudo dnf install php-cli
    sudo dnf install php-process
    マウスのナチュラルスクロールの設定はoffにする必要あり。
    ---

    •  0
    •  1
  2. れんと:

    ●お試しとご連絡ありがとうございます! 無事に動いて安心しました。

    それから、情報をありがとうございました。あとで、「確認済み環境」などとして記載したいと思います。

    •  0
    •  1

コメントを書く

名前    

メール 

URL