How to Speed Up Your Linux Desktop with Compton

Compton Feature

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:

For Fedora/Red Hat systems:

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.

MATE and Xfce are slightly easier to get working than KDE, so we’ll start there, continuing in order of ascending difficulty.

MATE

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

Compton Mate Disable Compositor

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.

Compton Mate Startup

First, name the command so you can find it (Compton!), and add the full command in the Command field.

Compton Mate Popup

XFCE

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

Compton Xfce Compositor Settings

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.

Compton Xfce Autostart Addbutton

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.

Compton Xfce Compositor Autostart Popup

KDE

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.

Compton Kde Pretty 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.

Compton Kde Showoff

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.

Compton Kde Disable Compositor

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:

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

Compton Kde Permissions

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.

Compton Kde Startup

Are you still experiencing screen tearing despite an awesome compositor like Compton? See our guide on how to remove screen-tearing from Linux.

Related:

11 comments

  1. If you were around for Win 3.2 and dial up, you would realize the gains in speed are so small today to really be insignificant. I use Ubuntu Mate, and am more than satisfied with the speed.

    1. Does Windows 3.11 count? (I was still mostly using my Commodore 64 a the time though!).
      As noted already, XFCE and MATE are already pretty light. If you’re using newer hardware, there won’t be a tangible difference, but older hardware may squeeze out a few more FPS. Compton’s chief advantage over MATE or XFCE is in handling screen tearing. My test laptop – with a particularly nasty video chip – still tore in the top portion of the screen with MATE and XFCE, where Compton cleaned it up nicely.

  2. [tkhoryk@lenovo ~]$ compton –vsync opengl-swc –backend glx
    picom doesn’t accept positional arguments.

    1. Is that a console error message? Picom isn’t compton, it’s a fork – are you using an Arch system per chance?

  3. John Knight: Yes, XFCE on Manjaro Linux which is Arch derivative. I installed “Compton” from the official repository, not AUR. So, this article isn’t useful for me at all, is it?

    1. I had to stick my head in the sand with Arch-based distros, because a fork of a project is just too much complexity to deal with in a small article like this. Still, this is a good opportunity, and I’m glad you’re here. Can you try Picom/Compton as is, with just the compton command, and remove all of the switches and arguments that follow it? If Picom is a fork, it may be updated to remove the need for all the messy twaddle after the command. I’d be particularly keen to know if it fixes screen tearing as-is.

  4. John Knight: Well I did that:

    [tkhoryk@lenovo ~]$ compton
    [ 13.06.20 23:15:52.370 session_init WARN ] This compositor has been renamed to “picom”, the “compton” binary will not be installed in the future.

    After this try in a terminal, the line Compton (X Composer) (A X Composer) already is in Autostart list, but it is not edible, so I can’t even see the full command. So I activated it and re-login the session. Everything seems to work properly, though I can’t see any significant acceleration. The command on login may be as following:

    [tkhoryk@lenovo ~]$ pgrep -a compton
    27483 compton –dbus

    1. What is your desktop? If you have newer hardware and are using a lighter desktop like MATE or XFCE, then you aren’t going to see any real improvement in speed, because they are already pretty light to begin with, but you may get benefits on old hardware and Compton is better at handling screen tearing (I’ve no idea about picom though).

  5. John Knight: I have the Lenovo laptop which is about 8-9 years old with the Intel graphics. Is it not old enough to see a difference? Screen tearing also was not a problem with the regular Composer. I don’t mean the composer substitution isn’t helpful at all, I mean it is helpless for me particular.

    1. That’s actually quite young for a Linux laptop (or at worst, middle-aged!). ;-) My mum has Linux Mint on a similarly aged laptop (maybe a bit older) and it runs great, and never gives her any trouble. Once you get down to Vista-era laptops, that’s where you start needing minimalist software.

  6. Installing on Kubuntu. Your right about “The desktop now reacts so quickly it’s almost violent”. Very noticeable from the start. I don’t use the items you mentioned either. I will keep it running to see if any noticeable difference or issues ahead.

    Unrelated to Compton, but all the so called lite distro’s are slower in starting Firefox.
    The heavyweights, such as, Ubuntu, Budgie, Cinnamon are lightening fast when I start up Firefox.
    The slower ones, especially xfce, I can see the Firefox browser get “painted”, while the others pop up.
    I’m guessing something is going on behind the scene. And no Firefox isn’t still running in the background. And the Performance is the same on each.

    I tried using speedup Firefox using Ghostery, and Disconnect. Didn’t make a difference in painting the Firefox screen. With Ghostery I can see the speed of each page I go to.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.