Screen tearing when using i3, none when using unity

33,956

The Unity Shell UI is a plugin of the Compiz compositing window manager (Unity Wiki) while i3 a standalone window manager without native compositing features. That means that by default Unity utilizes all manner of graphics acceleration features and i3 uses "plain" X11.


In order to get compositing features in i3, you will have to start a composite manager (not a compositing window manager). compton is a quite popular choice to use with i3.

Installation is easy as packages for Ubuntu are available in the official repository for trusty and newer. After installation you have to create a configuration, for example at ~/.config/compton.conf (as the location of the configuration file can be passed as argument to compton, the choice is yours). My compton.conf looks like this:

# basic configuration
backend = "glx";
vsync = "opengl-swc";

glx-copy-from-front = true;
glx-swap-method = 2;
xrender-sync = true;
xrender-sync-fence = true;

# transparancy settings for i3
opacity-rule = [
    "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];

It is possible that you need to adjust it for your system. Now you can start compton:

compton --config ~/.config/compton.conf -b

After you made sure that it works well, you can start it automatically by adding

exec --no-startup-id compton --config ~/.config/compton.conf -b

to your ~/.i3/config.

Note: I strongly suggest updating i3 to at least version 4.12 (the current release at time of posting). It solves a few rendering issues i3 has in conjunction with compton, at least when cairo ≥ 1.14.4 is available (xenial comes with cairo 1.14.6; see i3 Release Notes).

Share:
33,956

Related videos on Youtube

Charles S
Author by

Charles S

Updated on September 18, 2022

Comments

  • Charles S
    Charles S over 1 year

    I was attempting to use i3 on my ubuntu installation the other day. I noticed however that when I would logout and switch to using i3 I would start to see tearing when watching videos or scrolling through websites. This is something I do not notice when using unity. I would really like to be able to use i3 but currently cannot due to screen issues.

    Would anyone have a suggestion as to what might be causing this? What ends up being different between i3 and unity as far as displaying the screen? Most of the threads I read about screen tearing referred to compiz. Wouldn't compiz be the same on both ubuntu and i3?

  • Olathe
    Olathe about 8 years
    compton is a very nice lightweight compositor.
  • Charles S
    Charles S about 8 years
    @Adaephon Thank you so much! This has been a headache of mine for a while.
  • Hubro
    Hubro over 6 years
    Man, I'm so glad I found this answer. I had no idea the backend option existed. Setting it to glx basically fixed everything for me. All tearing is gone and browser scrolling is silky smooth.
  • Boris Verkhovskiy
    Boris Verkhovskiy almost 4 years
    I start compton as the first line in my i3 config and nothing has changed, I still get screen tearing in Chrome.
  • Adaephon
    Adaephon almost 4 years
    @Boris It does not really matter, where you put this in the i3-config. For one, there is no guarantee that the commands are executed in order nor does i3 wait for any command to fully run before starting the next. For another, compton itself can be started at any point later in a running i3 session and should work just fine. That being said, I have noticed some screen tearing issues on multi-display setups, where the refresh rate of the displays does not match 100% (e.g. 59.97 Hz vs 60.01 Hz) and the output is synced to the "wrong" display. Unfortunately, I have not yet found a solution.