Projects/KWin/Scripting Update Notes

< Projects‎ | KWin
Revision as of 17:46, 3 January 2012 by Mgraesslin (Talk | contribs) (close -> closeWindow)

Jump to: navigation, search

The KWin Scripting functionality has been reworked and extended in the KDE Plasma Workspaces version 4.9. Unfortunately it was not possible to keep the API 100 % compatible. This document lists most changes. The new API is documented in Development/Tutorials/KWin/Scripting/API_4.9.

In general the API has been changed to make greater use of Properties. This has been done to be able to use the same API in both JavaScript and QML. So instead of

var opacity = client.opacity();
opacity = opacity*0.5;


client.opacity = client.opacity*0.5;


All methods are available as properties with the same name as the getter methods in the old API except hasAlpha which is just alpha.



The following methods are no longer available:

  • move(): use the geometry property
  • resize(): use the geometry property
  • getWindowInfo(): properties of WindowInfo are merged into Toplevel and Client. See notes to WindowInfo.
  • activate(): use workspace.activateClient() (TODO: currently not yet available)
  • setCaption(): caption cannot be updated through JavaScript. This was an incorrect exported method. Use XProperties
  • unminimize(): set minimized property to false.

The following methods have been renamed as properties:

  • isTransient() -> transient
  • isTransientFor() -> transientFor
  • isShade() -> shade
  • isShadeable() -> shadeable
  • isMinimized() -> minimized
  • isMinimizable() -> minimizable
  • isMaximizable() -> maximizable
  • isResizable() -> resizeable
  • isMovable() -> moveable
  • isMovableAcrossScreens() -> moveableAcrossScreens
  • isCloseable() -> closeable
  • isFullScreen()/setFullScreen() -> fullScreen
  • isFullScreenable() -> fullScreenable

The following methods have been renamed:

  • close() -> closeWindow()


The events are documented as Signals in the new documentation. The new API follows the pattern of emitting a signal whenever a value changes. Use the property to query the new value. If the old value is required you should save the state in your script.

The following signals have been renamed:

  • clientMoved -> geometryChanged
  • minimized -> minimizedChanged
  • activated -> activeChanged
  • unminimized -> minimizedChanged
  • fullScreenSet -> fullScreenChanged


ClientGroup is no longer instantiable. This was an error in the previous API version. In order to use the ClientGroup just access the Client's clientGroup property. If the value is null this means the Client is undecorated and a ClientGroup cannot be used.

Methods changed to Properties

  • clients()
  • minSize()
  • maxSize()


WindowInfo is no longer provided. All relevant properties are merged into Toplevel or Client.

Moved Properties

  • isMinimized -> Client.minimized
  • windowRole -> Toplevel.windowRole
  • windowClassClass -> Toplevel.resourceClass
  • windowClassName -> Toplevel.resourceName

Dropped Properties

  • isValid
  • visibleName: best match Client.caption
  • state: use better properties on Toplevel and Client

Content is available under Creative Commons License SA 4.0 unless otherwise noted.