How to prevent screen flickering and tearing on KDE?

How to prevent screen flickering and tearing on KDE?
Photo by Soundtrap / Unsplash

Screen flickering and tearing can be super annoying while you are trying to capture a full-screen recording of your screen. This is usually caused by a compositing window manager, which quite often is the case these days. Compositors are visually great and result in a beautiful desktop experience, but they may come with their unexpected set of problems.

My main desktop manager currently is KDE. I could not find proper compositor settings from the system settings. So I turned to the terminal for a quick resolution and found the following set of commands to control the compositor.

To disable the compositor, I run the following in the terminal

qdbus org.kde.KWin /Compositor suspend

After the recording is over, I turn the compositor back on by running

qdbus org.kde.KWin /Compositor resume

This resolved my all flickering and tearing issues when recording full screen. It turned out that recording a window was fine with the compositor active.