qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.active
Gives you true or false depending on whether it is currently enabled or not
You can enable compositing by calling
qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.resume
and disable by calling
qdbus org.kde.KWin /Compositor org.kde.kwin.Compositing.suspend
also alt-shift-F12 toggles compositing
The
resume
andsuspend
methods have been removed in more recent version. You can still check it through theactive
property and the shortcut still works.