Screen tearing when using i3, none when using unity

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?


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).