KWin/Environment Variables

From KDE Community Wiki

Available Environment Variables

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

KWIN_COMPOSE

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)

KWIN_NVIDIA_HACK

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_DIRECT_GL

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.

KWIN_GL_DEBUG

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.

KWIN_FORCE_LANCZOS

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.

KWIN_FORCE_SW_CURSOR

On Wayland set this variable to directly use a software rendered mouse cursor instead of trying to probe for a cursor plane. It is recommended to only set this environment variable for debugging and not set it in general because using a cursor plane improves performance and KWin should fall back to software rendered cursor in case it can not find a suitable cursor plane.

KWIN_OPENGL_INTERFACE

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.

KWIN_USE_BUFFER_AGE

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

KWIN_EXPLICIT_SYNC

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_TRIPLE_BUFFER

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)!

UNDOCUMENTED: as of end 2015, the binary nvidia driver does not block on doublebuffered swapping, thus it is "safe" to make kwin falsely believe this is a triple buffering system. The behavior may change anytime with a driver update. See https://bugs.kde.org/show_bug.cgi?id=346275

KWIN_USE_INTEL_SWAP_EVENT

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 https://bugs.kde.org/show_bug.cgi?id=342582

  • 1: enforce usage

KWIN_PERSISTENT_VBO

Performance feature that requires GL_ARB_sync and GL_ARB_buffer_storage extension to use a ring buffer instead of reallocating vertex buffer objects.

  • "0" explicitly disable it

KWIN_DBUS_SERVICE_SUFFIX

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

KWIN_NO_XI2

Set to disables X11 XInput2 integration. This environment variable is supported since 5.6.

KWIN_EFFECTS_FORCE_ANIMATIONS

Allows to force override whether animations should be forced on or off. The recommendation of the compositor will be override. This environment variable is supported since 5.8.

  • "0" explicitly disable animations
  • "1" explicitly enable animations

KWIN_XKB_DEFAULT_KEYMAP

This environment variable forces the xkb integration on Wayland to use a default keymap instead of using the configured one. Mostly required for testing. This environment variable is supported since 5.8.

KWIN_NO_REMOTE

When this variable is set, KWin will not allow remote access, which means no screen sharing or remote desktop. This environment variable is supported since 5.13.



Related, maybe usable variables

__GL_YIELD

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.

__GL_SYNC_DISPLAY_DEVICE

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"

LIBGL_DEBUG

  • 1: enable libgl debug messages

XLIB_SKIP_ARGB_VISUALS

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 "kwin_env.sh" with the variables you wish to set .

#!/bin/sh

export FOO=bar

export BAR=foo


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

KDE SC 4

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

KF 5

~/.config/plasma-workspace/env/