Auto start compton in Lubuntu 16.04

Sorry for my bad EnglishMy problem is screen tearing in Lubuntu 16.04, my GPU is Intel HD graphic I install compton and this command help me$ compton -b --vsync openglBut I want to auto start compton so I search the Internet for this. I edit the file /etc/xdg/lxsession/Lubuntu/autostart by adding this line @compton -b --vsync openglBut it do not work, can anyone help me?

$ 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:
--
-- 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:
--
-- 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:
--
-- 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:
--
-- 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:
--
-- 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

1 Answer

You can use a simple systemd service to autostart it:

  1. Create a service file:

    sudo nano /etc/systemd/system/mycompton.service
  2. Add the following configurations:

    [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
  3. Start and enable the compton service:

    sudo systemctl start mycompton
    sudo systemctl enable mycompton
  4. Check the status:

    systemctl status mycompton
  5. Stop it with:

    sudo systemctl stop mycompton

Note:

Replace the line /usr/bin/coompton with the result of which compton, if different from my own entry.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like