Projects/KWin/Scripting Update Notes: Difference between revisions
Mgraesslin (talk | contribs) (close -> closeWindow) |
Mgraesslin (talk | contribs) (Workspace changes) |
||
Line 11: | Line 11: | ||
client.opacity = client.opacity*0.5; | client.opacity = client.opacity*0.5; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Workspace == | |||
=== 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''' | |||
== Toplevel == | == Toplevel == |
Revision as of 18:40, 1 February 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;
Workspace
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
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.
Client
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()
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
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.
Methods changed to Properties
- clients()
- minSize()
- maxSize()
WindowInfo
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