对不起,我的英语不好
我的问题是 Lubuntu 16.04 中的屏幕撕裂,我的 GPU 是 Intel HD 图形,我安装了 compton,这个命令对我有帮助, 但我想自动启动 compton,所以我在互联网上搜索这个。我通过添加此行来$ compton -b --vsync opengl
编辑文件 ,但它不起作用,有人能帮助我吗?/etc/xdg/lxsession/Lubuntu/autostart
@compton -b --vsync opengl
$ which compton
/usr/bin/compton
$ sudo systemctl status mycompton.service
● mycompton.service - compton autostart script
Loaded: loaded (/etc/systemd/system/mycompton.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since T5 2017-09-07 15:59:44 ICT; 5s ago
Process: 6342 ExecStart=/usr/bin/compton -b --vsync opengl (code=exited, status=1/FAILURE)
Th09 07 15:59:44 GaCon systemd[1]: Failed to start compton autostart script.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Unit entered failed state.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Failed with result 'exit-code'.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Service hold-off time over, scheduling restart.
Th09 07 15:59:44 GaCon systemd[1]: Stopped compton autostart script.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Start request repeated too quickly.
Th09 07 15:59:44 GaCon systemd[1]: Failed to start compton autostart script.
$ journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mycompton.service has finished shutting down.
Th09 07 15:59:44 GaCon systemd[1]: Starting compton autostart script...
-- Subject: Unit mycompton.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mycompton.service has begun starting up.
Th09 07 15:59:44 GaCon compton[6342]: session_init(): Can't open display.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Control process exited, code=exited status=1
Th09 07 15:59:44 GaCon systemd[1]: Failed to start compton autostart script.
-- Subject: Unit mycompton.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mycompton.service has failed.
--
-- The result is failed.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Unit entered failed state.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Failed with result 'exit-code'.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Service hold-off time over, scheduling restart.
Th09 07 15:59:44 GaCon systemd[1]: Stopped compton autostart script.
-- Subject: Unit mycompton.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mycompton.service has finished shutting down.
Th09 07 15:59:44 GaCon systemd[1]: mycompton.service: Start request repeated too quickly.
Th09 07 15:59:44 GaCon systemd[1]: Failed to start compton autostart script.
-- Subject: Unit mycompton.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mycompton.service has failed.
--
-- The result is failed.
Th09 07 15:59:50 GaCon sudo[6344]: lhv : TTY=pts/0 ; PWD=/home/lhv ; USER=root ; COMMAND=/bin/systemctl status mycompton.service
Th09 07 15:59:50 GaCon sudo[6344]: pam_unix(sudo:session): session opened for user root by (uid=0)
Th09 07 15:59:50 GaCon sudo[6344]: pam_unix(sudo:session): session closed for user root
Th09 07 16:00:14 GaCon com.canonical.indicator.application[974]: (process:1199): indicator-application-service-WARNING **: Application already exists, re-requesting pro
lines 2628-2669/2669 (END)
答案1
您可以使用一个简单的systemd
服务来自动启动它:
创建服务文件:
sudo nano /etc/systemd/system/mycompton.service
添加如下配置:
[Unit] Description=compton autostart script After=network.target [Service] Type=forking ExecStart=/usr/bin/compton -b --vsync opengl Restart=always [Install] WantedBy=multi-user.target
启动并启用 compton 服务:
sudo systemctl start mycompton sudo systemctl enable mycompton
检查状态:
systemctl status mycompton
停止它:
sudo systemctl stop mycompton
笔记:
如果与我自己的输入不同,则/usr/bin/coompton
用的结果替换该行。which compton