Difference between revisions of "Projects/KWin/Scripting Update Notes"

< Projects‎ | KWin
Jump to: navigation, search
(Workspace changes)
(ClientGroup)
 
Line 67: Line 67:
  
 
== ClientGroup ==
 
== ClientGroup ==
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.
+
ClientGroup is no longer available. Have a look at the tab* methods on Client.
 
+
=== Methods changed to Properties ===
+
* '''clients()'''
+
* '''minSize()'''
+
* '''maxSize()'''
+
  
 
== WindowInfo ==
 
== WindowInfo ==

Latest revision as of 08:12, 6 March 2012

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.setOpacity(opacity);

use

client.opacity = client.opacity*0.5;

Contents

[edit] Workspace

[edit] Methods

The following methods have been renamed as properties:

  • dimensions() -> displaySize
  • desktopGridSize() -> desktopGridSize
  • activeClient() -> activeClient

The following methods have been renamed:

  • getAllClients() -> clientList(), with the addition that sorting for desktop is no longer provided

The following methods have been removed:

  • clientGroups

[edit] Toplevel

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

[edit] Client

[edit] Methods

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

[edit] Events

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

[edit] ClientGroup

ClientGroup is no longer available. Have a look at the tab* methods on Client.

[edit] WindowInfo

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

[edit] Moved Properties

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

[edit] Dropped Properties

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

This page was last modified on 6 March 2012, at 08:12. This page has been accessed 2,657 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal