Fedora 26でマウススクロールを反転させるコマンドを開始するには?

Fedora 26でマウススクロールを反転させるコマンドを開始するには?

起動時に「xinput set-prop 13 289 1」コマンドを実行しようとしています。

reversemouse.serviceというシステムサービスを作成しました。

実行しようとすると、次のエラーが発生します。

[brandon@localhost ~]$ sudo systemctl status reversemouse.service 
● reversemouse.service - Description of the systemd service
   Loaded: loaded (/etc/systemd/system/reversemouse.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-07-17 21:11:51 EDT; 4s ago
  Process: 2863 ExecStart=/usr/bin/sh -c xinput set-prop 13 289 1 (code=exited, status=1/FAILURE)
 Main PID: 2863 (code=exited, status=1/FAILURE)

Jul 17 21:11:51 localhost.localdomain systemd[1]: Starting Description of the systemd service...
Jul 17 21:11:51 localhost.localdomain sh[2863]: Unable to connect to X server
Jul 17 21:11:51 localhost.localdomain systemd[1]: reversemouse.service: Main process exited, code=exited, sta
Jul 17 21:11:51 localhost.localdomain systemd[1]: Failed to start Description of the systemd service.
Jul 17 21:11:51 localhost.localdomain systemd[1]: reversemouse.service: Unit entered failed state.
Jul 17 21:11:51 localhost.localdomain systemd[1]: reversemouse.service: Failed with result 'exit-code'.

このエラーが何を意味するのかご存知ですか? systemdサービスの形式を正しく指定しましたか?これは私のシステムサービスです。

[Unit]
Description=Description of the systemd service

[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "xinput set-prop 13 289 1"

[Install]
WantedBy=default.target

ベストアンサー1

デスクトップアプリケーションを作成して問題を解決しました。

~/.config/autostart で、次のようにデスクトップファイルを作成します。

[Desktop Entry]
Name=startup
GenericName=startup
Comment=Start these up at login
Exec=/home/[your username]/reversemouse.sh
Terminal=False
Type=Application
X-GNOME-Autostart-enabled=true

次に、コピーしたデスクトップファイルを自動起動フォルダにコピーします。 /usr/share/applications/ を ~/.config/autostart/ にコピーします。

最後に、実行したいコマンドを使用して起動ファイル(reversemouse.sh)を作成しました。

#!/bin/bash

xinput set-prop 13 289 1

おすすめ記事