t_wの輪郭

トラックパッドのジェスチャー
Ubuntuでトラックパッドのジェスチャーを使う方法 ── トラックパッド再接続後にもジェスチャーしたい ──あれ`libinput-gestures-setup stop service autostart st...libinput-gesturesのsytemd user serviceを再起動するudevルールlibinput-gesturesをsystemd user serviceとして動かす『bulletmark/libinput-gestures: Actions gestures on...振り返り2025年10月29日あれあれあれあれ『libinput - ArchWiki』

この文章では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になっていることが表示されるはずです。

app-my\x2dlibinput\x2dgestures@autostart.service                  generated -
libinput-gestures.service                                         enabled   enabled

Bluetooth接続時にlibinput-gestures.serviceを再起動するudevルールを設定する

/etc/udev/rules.d/90-gestures-restart-on-bt-touchpad.rulesなどに下記のルールを記載します。<USER>はあなたのユーザー名に変更してください。

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"

記載後、sudo udevadm control --reloadを実行してルールを有効化します。


再起動時のlibinput-gestures.service再起動を設定する

Startup Application Preferencesを開き、下記コマンドを設定します。
systemctl --user restart libinput-gestures.service