KWin/Environment Variables

Available Environment Variables

KWin supports a number of environment variables to overwrite some settings or checks. The following variables are supported:


The environment variable KWIN_COMPOSE enforces a compositing backend or forces compositing completely off. The following values are supported:

  • O: OpenGL backend (either OpenGL 1, OpenGL 2 or OpenGL ES 2.0)
  • O1: OpenGL 1 backend (only 4.x)
  • O2: OpenGL 2 backend
  • "O2ES": OpenGL ES 2 backend (since 5.5)
  • X: XRender backend (only X11)
  • Q: QPainter backend (only Wayland)
  • N: No Compositing (only X11)


By default KWin uses an NVIDIA specific hack to set __GL_YIELD to NOTHING. By setting "KWIN_NVIDIA_HACK" to "0" this behavior can be disabled. This environment variable is uneffective since at least 4.8.


KWin determines whether LIBGL_ALWAYS_INDIRECT has to be set by an external helper application and a driver whitelist of the drivers known to perform well with direct rendering. By setting the environment variable KWIN_DIRECT_GL to 1 the checks are not performed and LIBGL_ALWAYS_INDIRECT is not set.

This environment variable is only supported in 4.x.


By setting KWIN_GL_DEBUG to 1 the OpenGL rendering can be debugged visually. All geometries which are rendered are overlayed by a wireframe. The wireframe is not available in OpenGL ES 2.0. The environment variable is supported since 4.7.


The lanczos filter is controlled by the scale method in the advanced compositing settings and a blacklist of drivers known to break with this filter. The setting and the blacklist can be overruled by setting KWIN_FORCE_LANCZOS to 1. This environment variable is supported since 4.8.


By setting KWIN_OPENGL_INTERFACE to egl the OpenGL based compositor uses the EGL platform interface instead of the GLX. This environment variable is supported since 4.10.


More recent GL drivers allow to re-use the (n-)last frontbuffer as current backbuffer, what means that only a fraction of the screen has to be painted which was really changed. This adds quite some performance and is enabled by default (if your driver supports it ("glxinfo | grep GLX_EXT_buffer_age", needs to be matched at least twice!) It may cause artifacts, so you can try to disable it:

  • 0: disabled


The GL_EXT_x11_sync_object extension (check "glxinfo | grep GL_EXT_x11_sync_object", needs to be matched at least twice!) allows to synchronize X11 and OpenGL command streams (guarantee X11 "foo" happend before GL "bar" is executed) If supported it's enabled by default but is prone to cause "lockups", so you might try to disable it:

  • 0: disabled


KWin tries to detect whether triple buffering is available by measuring the invocation of glSwapBuffers (during the initial frames) - this is heuristic and can result in a wrong assumption of the condition, thus the wrong swapping strategy.

  • 0: override detection as unavailable
  • 1: override detection as available

NOTICE: this does NOT enable triple buffering in the driver! Forcing KWin into the wrong strategy will usually cause inferior performance ("laggy" behavior)!


This is a fairly new feature of the intel driver. It's only available with Qt >= 5.4 As it caused major issues (freeze, compositing simply never updates) it's currently disabled by default and must be explicitly enabled (on your own risk) - see

  • 1: enforce usage


Suffix for the DBus-Service name "org.kde.KWin". If set, the name will be changed to "org.kde.KWin.${KWIN_DBUS_SERVICE_SUFFIX}". This environment variable is supported since 5.2. In a multi-head environment on the non-primary heads a ".head-${number}" will be appended, so overall e.g. "org.kde.KWin.${KWIN_DBUS_SERVICE_SUFFIX}.head-1".

Related, maybe usable variables


Not yielding can cause quite some CPU overhead, so on systems that do NOT provide triple buffering, V'Sync will be turned off except for __GL_YIELD=USLEEP

  • ': By default, OpenGL will call sched_yield() to yield. This can cause the process to be scheduled out for a relatively long period of time or never yield (sched_yield can easily end up being NOOP)
  • USLEEP: OpenGL will call usleep(0) to yield.
  • NOTHING: OpenGL will never yield.


Consumer GPUs can only sync to one monitor. This variable allows to control which that will be (default is primary) Lookup valid identifiers (eg. LVDS1, HDMI-0 or DVI-I-1) with eg. "xrandr -q"


  • 1: enable libgl debug messages


This isn't relevant for KWin, but maybe some clients. You have to set it for such client process (eg. "XLIB_SKIP_ARGB_VISUALS=1 xmms") It prevents them from using ARGB windows (ie. partial transparency) - especially gtk-1 (the original gnome toolkit) used them "wrongly"

  • 1: enforce 24bit windows

Set variables at session start

  • Create a script file "" with the variables you wish to set .


export FOO=bar

export BAR=foo

  • Make the script executable (file properties or "chmod +x")
  • Place the script in a sourced path


~/.kde/env/ This is ~/.kde4/env/ on some distributions - compare the output of "kde4-config --path config"

KF 5


This page was last edited on 28 August 2018, at 11:01. Content is available under Creative Commons License SA 4.0 unless otherwise noted.