How To Get Window Compositing On Lightweight Linux Desktops With Compton
One of the worst drawbacks to using a lightweight desktop environment is the fact that it forgoes a lot of modern features. For example: on XFCE4, if you’re watching a full-screen video from the web browser, chances are, there’s going to be a lot of screen-tearing. This is because light-weight desktops generally don’t have a good compositor (for performance reasons). As a result of not having a good compositor, you’ll experience a lot of gross screen tearing, and generally your desktop environment won’t look as modern as it could. For some people, this is something they accept and ignore. For others, a lack of window compositing is probably one of the main reason people go back to heavier desktop environments like KDE and Gnome.
SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.
Fortunately, there is a way to give lightweight desktop environments true window compositing. It involves installing the Compton window compositor. With the Compton compositor enabled on your light-weight environment, screen tearing troubles will disappear, and everything will look a lot nicer.
How To Install Compton
Ubuntu
sudo apt install compton compton-conf
Debian
sudo apt-get install compton compton-conf
Arch Linux
sudo pacman -S compton
Be sure to also build the GUI Compton-conf configuration tool from the AUR for Arch.
Fedora
sudo dnf copr enable dschubert/compton -y sudo dnf install compton -y
Also install compton-conf:
sudo dnf install https://download.opensuse.org/repositories/home:/AndnoVember:/LXQt/Fedora_26/x86_64/compton-conf-0.3.0.11~git.ae2c110-18.1.x86_64.rpm
OpenSUSE
The Compton X compositor is available to all OpenSUSE users via the OBS. Go to the download page, select your version of SUSE and then click the install button to get the software.
Other Linuxes
Your Linux distribution not mentioned above? Don’t worry! Compton is fairly common, and most Linux distributions carry it. To install it, open a terminal and search for “compton” using your operating system’s package manager. Alternatively, grab the source code directly from the developer’s GitHub and compile it!
Enabling Compton On XFCE4
After installing the Compton window compositor on your XFCE4 desktop, it won’t work right away. You will need to start it first. Open the XFCE settings window. Inside settings, look for “window manager tweaks” and click on it. In the window manager area of settings, look for the “Compositor” tab and click on it.
Inside this tab, click the box to disable the built-in XFCE compositing software. This is critical, or Compton will not work.
With the default compositor disabled, open up a terminal and start up the nano text editor.
nano ~/.config/autostart/compton.desktop
Paste the following code inside of the Desktop file so that the compositor will start as you login:
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=Compton Comment=X11 compositor Exec=compton -b OnlyShowIn=XFCE; StartupNotify=false Terminal=false Hidden=false
Note: change the permissions of the Desktop file with chmod +x ~/.config/autostart/compton.desktop
Configure Compton On XFCE4
Automatic start is enabled, but Compton isn’t ready to be used on XFCE. You’ll first need to generate a configuration file. This can be done (tediously) in the terminal. Fortunately, Compton-conf exists. Press ALT + F2, type compton-conf and press “enter” on the keyboard to open it.
When the Compton conf tool opens, a default configuration file is generated. Go through the app and change options as you see fit. When done, click “apply”, and log out. When you log back in, Compton should be running on XFCE4!
Enabling Compton On LXDE/LXQT
Using Compton on LXDE and LXQT is similar to XFCE4, and the instructions are hardly different. The only real difference is that there is no need to disable a default composite tool, as there isn’t one. Instead, create the desktop file so that Compton may run at start-up.
nano ~/.config/autostart/compton.desktop
Paste this code into the file:
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=Compton Comment=X11 compositor Exec=compton -b OnlyShowIn=XFCE; StartupNotify=false Terminal=false Hidden=false
Update the permissions of the desktop file so that the system will read it correctly:
chmod +x ~/.config/autostart/compton.desktop
Lastly, open up Compton conf. Use the settings the tool selects by default. Alternatively, go through the tool and select different options. When done, click “apply” to add the settings to Compton. Then, log out. Upon Login, your LXDE/LXQT system should be using Compton.
Enabling Compton On MATE
Enabling Compton compositing on the Mate desktop environment is much easier than other lightweight desktop environments thanks to the Mate-Tweak tool. Install it by searching your package manager for “mate tweak”, compiling from source, or grabbing a package from pkgs.org.
When you’ve got Mate Tweak installed, click on “preferences” then “look and feel” in the menu on the taskbar. Inside “Look and Feel” select “Mate Tweak” and launch the program.
On the side-bar, look for “Windows” and select it. This area in the tweak tool allows users to change how compositing works on the Mate desktop.
To enable Compton GPU compositing, select the drop-down menu underneath “Window Manager”, look for “Marco (Compton GPU Compositor)” and select it to enable. Compositing should start instantly. If not, reboot your PC. On login, everything should be working.
Note: because Mate Tweak takes care of Compton, using Compton-conf isn’t necessary. That said, feel free to open it to tweak settings regardless.
I found on Ubuntu that this exec line works, while “compton -b” did not:
Exec=sh -c “sleep 10;/usr/bin/compton&”
Also there’s a slightly more up-to-date version in a ppa:
sudo add-apt-repository ppa:kelleyk/compton
sudo apt-get update
Thanks for a good/informative post. Interesting article, but I have to protest.
If one is intending writing a relatively technical report, one should at least attempt to do the reader the courtesy of checking that what one has written is correct.
One instance of “composting” (sic) for “compositing” might have been amusing, but the second instance was arguably mere carelessness. So what does that say of the rest of the content?
I read your post in a feed-reader. I do that so that I can scan the headlines for interesting subjects, and then, when I find one that sparks my interest, I stop and skim-read the post. If it is aligned with the context of the heading, and if it still looks good, then I’ll read it more thoroughly. However, if I spot at any point that it seems that the writer might not know his subject very well or may be just churning out verbiage to catch clicks, then I just click “next” in my feed-reader. I didn’t do that in this case (I nearly did) as I thought the writer might have not had any proof-readers for his post, and could be blissfully unaware of his simple language mistakes. So I took the trouble to write this comment, not to be a smartass, but in the hope that it might help someone or be of use. From experience as a technical document writer, I know that It is very difficult to properly proof-read one’s own writing, because one is often blind to one’s own errors.
So, I read the post, and I learned something from it, but at some point, I did wonder whether the author’s “composting” might not have been a Freudian slip that his post was, well, a pile of ordure… (only joking) 😉