Projects/KWin/Scripting Update Notes: Difference between revisions

From KDE TechBase
< Projects‎ | KWin
(Created page with "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...")
 
m (Use correct template XD)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Archived}}
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]].
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]].


Line 11: Line 13:
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 ==
All methods are available as properties with the same name as the getter methods in the old API.
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 ==
== Client ==
=== Methods ===
=== Methods ===
The following methods are no longer available:
The following methods are no longer available:
* '''close()''' (might be added again)
* '''move()''': use the '''geometry''' property
* '''move()''': use the '''geometry''' property
* '''resize()''': use the '''geometry''' property
* '''resize()''': use the '''geometry''' property
Line 40: Line 54:
* '''isFullScreen()/setFullScreen()''' -> '''fullScreen'''
* '''isFullScreen()/setFullScreen()''' -> '''fullScreen'''
* '''isFullScreenable()''' -> '''fullScreenable'''
* '''isFullScreenable()''' -> '''fullScreenable'''
The following methods have been renamed:
* '''close()''' -> '''closeWindow()'''
=== Events ===
=== 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 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.
Line 51: Line 69:


== 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 09:14, 31 May 2019


This page has been archived
The information on this page is outdated or no longer in use but is kept for historical purposes. Please see the Category:Archives for similar pages.

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 available. Have a look at the tab* methods on Client.

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