Desktop compositors have become a modern necessity, whether it be due to screen tearing or simply a yearning for desktop eye candy. While compositors often come at a cost – speed and resources – a tiny compositor is here to save the day: Compton. Able to run on even the lamest of machines, Compton can smooth out graphics on low-end hardware or make a new machine’s desktop lightning-fast.
For those not in the know, Compton is a super-lightweight standalone compositor designed to be used in conjunction with Linux desktops. Perfect for older hardware, it is often used by lightweight distros that need a compositor that won’t sacrifice speed and responsiveness. We’ve included instructions for three desktops here: KDE, MATE, and Xfce. Note that the same principles can be applied to many other desktops.
We were hoping to include GNOME and Cinnamon, but it appears their compositors are built in and cannot be replaced – let us know in the comments if that’s not the case and how to disable them.
Installing and Using Compton
Compton is very common and should be available in your distribution’s repositories. If not, instructions are included on the project’s GitHub page.
If you prefer to install by command line, for Debian or Ubuntu-based systems, enter:
sudo apt install compton
For Fedora/Red Hat systems:
sudo dnf install compton
This tutorial will cover three steps for each desktop after the point of installation: disabling your compositor, trying Compton in a shell, and adding Compton to your desktop’s list of auto-start programs.
Rather than using the command by itself, we’ll add switches to use OpenGL instead of the old X Render backend, which will give the desired performance.
compton --vsync opengl-swc --backend glx
MATE and Xfce are slightly easier to get working than KDE, so we’ll start there, continuing in order of ascending difficulty.
Neither of MATE’s or Xfce’s compositors are particularly heavy, but we found Compton was better at handling screen tearing and at least seemed faster than that of MATE or Xfce. (More fastidious users can measure such things!)
To disable your compositor, click “Menu -> Preferences -> Windows.” This will open a new window called “Window Preferences.” Under the General tab, uncheck the box that says “Enable software compositing window manager.”
With the compositor disabled, open a terminal and try running Compton. If it runs successfully, add it to MATE’s autostart by clicking “Menu -> Preferences -> Startup Applications.” In the new window, click Add. This will open a dialog for entering your command.
First, name the command so you can find it (Compton!), and add the full command in the Command field.
Xfce has essentially the same steps as MATE, just with more windows to navigate. Disable your compositor by opening the main Applications menu and clicking “Settings -> Window Manager Tweaks.” This will open a new window. Open the Compositor tab, and uncheck the option “Enable display compositing.”
Check that the command works in a terminal. If so, add it to your startup by clicking “Menu -> Applications -> Settings -> Session and Startup.” In the new window, open the “Application Autostart” tab and click the Add button.
In the “Add application” window, name your command, and enter the full command in the Command field. Leave Trigger set to “on login” and click OK.
Now this is where Compton will make a significant difference to performance. Compared to KDE’s native compositor, there was a substantial increase in speed and responsiveness. The desktop now reacts so quickly it’s almost violent. A game under Proton was suddenly running at 60+ FPS, where previously it was struggling.
Performance aside, Compton’s visual tweaks look gorgeous under KDE, with a very tasteful translucency on menus.
Combined with a dark theme, it gives the taskbar and menus a stylish black glass look, making for one of the most beautiful desktops we’ve ever used.
Note that although Compton generally runs well with KDE, it breaks when manually changing desktop resolutions through System Settings. This leaves you half a desktop with all the buttons and inputs in the wrong places. Logging out via keyboard shortcuts fixed the problem, but you should probably disable Compton through your system monitor before changing desktop resolutions.
Also worth noting is that you can no longer zoom out to see all desktops. This is something I rarely use, so I don’t really miss it, but if you rely on this feature, Compton isn’t for you.
Otherwise, Compton was generally more stable than KDE’s compositor, particularly when applications changed resolutions in fullscreen (even DOS games running in very low resolutions). If you’re a hardcore gamer, it’s worth stripping back on features for the serious performance gains on offer.
Getting Compton Working on KDE
To get Compton working with KDE takes more preparation. Don’t panic, as it’s not that hard. Disabling the compositor is easy enough. Just open KDE’s System Settings, go to “Display and Monitor,” open the Compositor section, and uncheck the box “Enable compositor on startup.” Try the given Compton command in a terminal, and if all is well, upi can move on.
This is where things get slightly harder. KDE’s Autostart dialogs won’t accept that raw Compton command with its switches, so you’ll have to make a basic script. Don’t worry, we’ll talk you through it.
Start by making a new text file. We’ll be calling it “compton-script.sh.” Copy and paste the following text into it:
#!/bin/bash /usr/bin/compton --vsync opengl-swc --backend glx
Save the file and make it executable by right-clicking on the file and choosing Properties. Open the Permissions tab and check the box “Is executable.”
That script is now ready to use. To add it to your startup, open System Settings and choose the “Startup and Shutdown” section where you will find Autostart. Once in Autostart, click the “Add Script” button and browse for your script file in the new dialog window. Click OK and you should be finished.
Are you still experiencing screen tearing despite an awesome compositor like Compton? See our guide on how to remove screen-tearing from Linux.
Our latest tutorials delivered straight to your inbox