0

So I've been having screentearing issues on my system for a while.

Finally figured out that running

compton --backend glx --vsync opengl

in the terminal allows me to get rid of the screen tearing.

So I dedcied it would be a good idea to add this command to startup so it simply runs everytime I boot up. However, although I now boot up screen tearing free, my second monitor (which is in fact my laptop's screen my main screen being an external monitor connected through VGA) is simply grey (though my mouse pointer is visible on top when moving to that screen but applications aren't). Killing compton gets rid of the problem and running the same command from the command line still works but I just can't figure out how to make it work from start up so any input you guys have would be super appreciated!

5
  • What is your GPU? Your question is not clear, do you want to start compton (it's picom now actually please update it) at startup ?
    – Alca
    Aug 10, 2021 at 18:26
  • Yes absolutely! My bad, I'm not really good at this. My GPU is an Nvidia GT 630M (old thing). I want to run the command mentionned above on startup to get rid of the screen tearing but when I make it as startup preference it makes my other montior go grey while if I run it manually from the terminal it do that.
    – tlleclerc
    Aug 10, 2021 at 21:13
  • You are perfectly fine, I've added an answer hopefully it will solve your problem. Also which Desktop Environment are you using LXQt?
    – Alca
    Aug 10, 2021 at 22:36
  • You've provided no release details, but have you looked in the manual? manual.lubuntu.me/stable/3/3.2/3.2.13/… (as I don't know your release, I've provided the stable release (ie. 21.04) so adjust URL to match your system if you're not using 21.04)
    – guiverc
    Aug 10, 2021 at 22:49
  • Sorry guys, I'm currently using Lubuntu 20.04 with LXQt.
    – tlleclerc
    Aug 10, 2021 at 23:35

1 Answer 1

0

There's plenty way of doing this but I mostly add apps or scripts that I want to start before Window Manager, I add them to .xprofile.

So create a magical file named .xprofile in your home directory. /home/username/.xprofile.

Add the following contents:

compton --backend glx --vsync opengl &

When you login it should start the apps or scripts you've provided. Alternatively if .xprofile does not work. You can create the .xinitrc and use it with the same content.

Extras:

  • I highly suggest you to, update compton to picom if you haven't done it yet.
  • Create a configuration file in .config/picom/picom.conf
  • Fill the config with sample config.
  • After saving your config edit your .xprofile with:
picom &
  • For your screen tearing issue this might solve it as well; after installing proprietary NVIDIA drivers (370 or higher version). Edit: Seems your GPU supports NVIDIA 390, you can install it with this command: sudo apt install nvidia-driver-390

    • You can try adding nvidia-drm.modeset=1 kernel parameter in /etc/grub/default to GRUB_CMDLINE_LINUX_DEFAULT, dont forget to update your grub as well with; sudo update-grub (Source)
  • If you need anything else feel free to reply :)


Edit 2: First try making .xprofile and/or .xinitrc executable with:

$ chmod +x .xprofile
$ chmod +x .xinitrc

If .xprofile and .xinitrc doesn't works let's create a configuration and directly start compton with LXQt Autostart.

  • Create a configuration in /home/username/.config/compton.conf
  • Add the following contents;
backend = "glx";
glx-no-stencil = true;

# Try to detect WM windows and mark them as active.
mark-wmwin-focused = true;

# Mark all non-WM but override-redirect windows active (e.g. menus).
mark-ovredir-focused = true;

# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events.
# Usually more reliable but depends on a EWMH-compliant WM.
use-ewmh-active-win = true;

# Painting on X Composite overlay window. Recommended.
paint-on-overlay = true;

# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe).
# Recommended if it works.
glx-no-rebind-pixmap = true;

# Set VSync method. VSync methods currently available:
# none: No VSync
# drm: VSync with DRM_IOCTL_WAIT_VBLANK. May only work on some drivers.
# opengl: Try to VSync with SGI_video_sync OpenGL extension. Only work on some drivers.
# opengl-oml: Try to VSync with OML_sync_control OpenGL extension. Only work on some drivers.
# opengl-swc: Try to VSync with SGI_swap_control OpenGL extension. Only work on some drivers. Works only with GLX backend. Known to be most effective on many drivers. Does not actually control paint timing, only buffer swap is affected, so it doesn’t have the effect of --sw-opti unlike other methods. Experimental.
# opengl-mswc: Try to VSync with MESA_swap_control OpenGL extension. Basically the same as opengl-swc above, except the extension we use.
# (Note some VSync methods may not be enabled at compile time.)
vsync = "opengl";

# If not specified or 0, compton will try detecting this with X RandR extension.
refresh-rate = 0;
  • With this you won't have to pass parameters to compton. You can Google it for detailed compton configurations.

  • I assume you are familiar with LXQt you can just add compton to Autostart. Preferences -> Default applications for LXSession -> Autostart -> Manual autostarted applications -> Add

  • If it doesn't work either you can do something like this;

    • Add this to line ~/.config/lxsession/Lubuntu/autostart (if it doesn't exist create it and make it executable with chmod +x)
@compton

or

@compton -b
  • -b parameter deamonizes the compton.
  • Hopefully compton will start with session.
6
  • Hey thanks again for your help. I added the line above /home/[myusername]/.xprofile but unfortunately it didn't stop the screen tearing like it does when manually running the command from the command line. I really wonder why it doesn't work the same... :( I'm really open to trying anything at this point.
    – tlleclerc
    Aug 10, 2021 at 23:49
  • Unfortunately, installing Nvidia 390 just made me boot into directly into black screens (not even the logging page) so I had to nomodeset on boot up and ALT+CTRL+F1 to remove and purge the Nvidia driver and reinstall the Nouveau driver.
    – tlleclerc
    Aug 11, 2021 at 0:20
  • Thats a bummer, I've had those issues when I was using 390 few years ago. Arch Wiki was really helpful you can check it out if you have some free time. Also there is actually no difference between running from your terminal or when startup, meantime you can pass -b parameter to compton it will run in background so you won't have to keep your terminal running in foreground. Can you confirm .xprofile starts up the compton when session starts as well? You can add the same line to your .xinitrc as well if compton won't start with .xprofile
    – Alca
    Aug 11, 2021 at 0:54
  • Bad news! I tried with .xprofile and with both .xprofile and .xinitrc but in either case compton didn't start when the session started.
    – tlleclerc
    Aug 11, 2021 at 2:53
  • @tlleclerc I've added more solutions, Today I learned LXQt is little painful to work with :)
    – Alca
    Aug 11, 2021 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .