Fedora
如何在 Fedora 26 中啟動命令以反轉滾動滑鼠?
我正在嘗試在啟動“xinput set-prop 13 289 1”時啟動以下命令
我創建了一個名為 reversemouse.service 的 systemd 服務
當我嘗試執行它時,我收到以下錯誤:
[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
我通過創建桌面應用程序解決了這個問題:
在 ~/.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