Ubuntuでトラックパッドのジェスチャーを使う方法 ── トラックパッド再接続後にもジェスチャーし...
この文章ではUbuntu24.04にてBluetooth接続のトラックパッド(Magic Trackpad 2)でジェスチャーを有効化した方法を説明します。
libinput-gesturesではトラックパッド再接続後にジェスチャーが効かなくなり、libinput-gestures.serviceを再起動すれば再度ジェスチャーが効くようになります。毎回コマンドを実行するのは手間ですので、bluetoothデバイスが接続されたときにlibinput-gesturesを自動で再起動するように設定します。
libinput-gesturesをインストールする
レポジトリ記載の手順に従ってインストールしてください。
レポジトリ:https://github.com/bulletmark/libinput-gestures
libinput-gesturesをsystemd user serviceとして動かす
下記コマンドを実行して、libinput-gesturesをsystemd user serviceとして動かします。
libinput-gestures-setup stop service autostart start
systemdでlibinput-gestures.serviceが動いていることを確認します
systemctl --user list-unit-files | grep gesture
下記のようにlibinput-gestures.serviceがenabledになっていることが表示されるはずです。
`libinput-gestures-setup stop service autostart st...
libinput-gesturesのsytemd user serviceを再起動するudevルール
ACTION=="add", SUBSYSTEM=="input", ENV{ID_INPUT_TOUCHPAD}=="1", ENV{ID_BUS}=="bluetooth", RUN+="/usr/bin/systemd-run --no-block --machine=<USER>@.host --user /usr/bin/systemctl --user restart libinput-gestures.service"
libinput-gesturesをsystemd user serviceとして動かす
『bulletmark/libinput-gestures: Actions gestures on...
あれ
トラックパッド(Bluetooth)がつながってない状態でlibinput-gestures restartを実行すると、ジェスチャーが使えなくなる。
トラックパッドはPC起動時にはつながっておらず、クリック操作をしてしばらくするとつながる。
トラックパッド接続時にlibinput-gestures restartを実行できれば、問題が解決しそう。