KDE 4.9 PyKDE API Reference

- KDE's Python API

# NETRootInfo Class Reference

`from PyKDE4.kdeui import *`

Inherits: NET

## Detailed Description

Common API for root window properties/protocols.

The NETRootInfo class provides a common API for clients and window managers to set/read/change properties on the root window as defined by the NET Window Manager Specification..

Author:
  Bradley T. Hughes <bhughes@trolltech.com>

See also:
  NET

See also:
  NETWinInfo

## Enumerations
<anonymous> | { PROTOCOLS, WINDOW_TYPES, STATES, PROTOCOLS2, ACTIONS, PROPERTIES_SIZE }
## Methods
| __init__ (self, Display display, long supportWindow, QString wmName, SIP_PYLIST properties, int screen=-1, bool doACtivate=1)
| __init__ (self, Display display, SIP_PYLIST properties, int screen=-1, bool doActivate=1)
| __init__ (self, Display display, long properties, int screen=-1, bool doActivate=1)
| __init__ (self, NETRootInfo rootinfo)
| activate (self)
long | activeWindow (self)
| addClient (self, long window)
| changeActiveWindow (self, long window, NET.RequestSource src, long timestamp, long active_window)
| changeCurrentDesktop (self, int desktop)
| changeDesktopGeometry (self, int desktop, NETSize geom)
| changeDesktopViewport (self, int desktop, NETPoint viewport)
| changeNumberOfDesktops (self, int numberOfDesktops)
| changeShowingDesktop (self, bool showing)
int | clientListCount (self)
int | clientListStackingCount (self)
| closeWindow (self, long window)
| closeWindowRequest (self, long window)
int | currentDesktop (self, bool ignore_viewport=0)
NETSize | desktopGeometry (self, int desktop)
QSize | desktopLayoutColumnsRows (self)
NET.DesktopLayoutCorner | desktopLayoutCorner (self)
NET.Orientation | desktopLayoutOrientation (self)
QString | desktopName (self, int desktop)
NETPoint | desktopViewport (self, int desktop)
| gotPing (self, long window, long timestamp)
| gotTakeActivity (self, long window, long timestamp, long flags)
bool | isSupported (self, NET.Property property)
bool | isSupported (self, NET.Property2 property)
bool | isSupported (self, NET.WindowType type)
bool | isSupported (self, NET.State state)
bool | isSupported (self, NET.Action action)
| moveResize (self, long window, int x_root, int y_root, long direction)
| moveResizeRequest (self, long window, int x_root, int y_root, NET.Direction direction)
| moveResizeWindow (self, long window, int flags, int x, int y, int width, int height)
| moveResizeWindowRequest (self, long window, int flags, int x, int y, int width, int height)
int | numberOfDesktops (self, bool ignore_viewport=0)
| removeClient (self, long window)
| restackRequest (self, long window, NET.RequestSource source, long above, int detail, long timestamp)
| restackWindow (self, long window, NET.RequestSource source, long above, int detail, long timestamp)
long | rootWindow (self)
int | screenNumber (self)
| sendPing (self, long window, long timestamp)
| setActiveWindow (self, long window, NET.RequestSource src, long timestamp, long active_window)
| setActiveWindow (self, long window)
| setClientList (self, long windows, long count)
| setClientListStacking (self, long windows, long count)
| setCurrentDesktop (self, int desktop, bool ignore_viewport=0)
| setDesktopGeometry (self, int desktop, NETSize geometry)
| setDesktopLayout (self, NET.Orientation orientation, int columns, int rows, NET.DesktopLayoutCorner corner)
| setDesktopName (self, int desktop, QString desktopName)
| setDesktopViewport (self, int desktop, NETPoint viewport)
| setNumberOfDesktops (self, int numberOfDesktops)
| setShowingDesktop (self, bool showing)
| setSupported (self, NET.Property property, bool on=1)
| setSupported (self, NET.Property2 property, bool on=1)
| setSupported (self, NET.WindowType property, bool on=1)
| setSupported (self, NET.State property, bool on=1)
| setSupported (self, NET.Action property, bool on=1)
| setVirtualRoots (self, long windows, long count)
| setWorkArea (self, int desktop, NETRect workArea)
bool | showingDesktop (self)
long | supportWindow (self)
| takeActivity (self, long window, long timestamp, long flags)
int | virtualRootsCount (self)
QString | wmName (self)
NETRect | workArea (self, int desktop)
Display | x11Display (self)

## Method Documentation

__init__ | ( | self, |
|  | Display | display,
|  | long | supportWindow,
|  | QString | wmName,
|  | SIP_PYLIST | properties,
|  | int | screen=-1,
|  | bool | doACtivate=1
| ) |  |  |

__init__ | ( | self, |
|  | Display | display,
|  | SIP_PYLIST | properties,
|  | int | screen=-1,
|  | bool | doActivate=1
| ) |  |  |

This constructor differs from the above one only in the way it accepts the list of supported properties. The properties argument is equivalent to the first element of the properties array in the above constructor, and therefore you cannot read all root window properties using it.

__init__ | ( | self, |
|  | Display | display,
|  | long | properties,
|  | int | screen=-1,
|  | bool | doActivate=1
| ) |  |  |

This constructor differs from the above one only in the way it accepts the list of supported properties. The properties argument is equivalent to the first element of the properties array in the above constructor, and therefore you cannot read all root window properties using it.

__init__ | ( | self, |
|  | NETRootInfo | rootinfo
| ) |  |  |

Creates a shared copy of the specified NETRootInfo object.

Parameters:

  | rootinfo | the NETRootInfo object to copy

activate | ( |  | self ) |

Window Managers must call this after creating the NETRootInfo object, and before using any other method in the class. This method sets initial data on the root window and does other post-construction duties.

Clients must also call this after creating the object to do an initial data read/update.

long activeWindow | ( |  | self ) |

Returns the active (focused) window.

Returns:
  the id of the active window

addClient | ( | self, |
|  | long | window
| ) |  |  |

A Client should subclass NETRootInfo and reimplement this function when it wants to know when a window has been added.

Parameters:

  | window | the id of the window to add

changeActiveWindow | ( | self, |
|  | long | window,
|  | NET.RequestSource | src,
|  | long | timestamp,
|  | long | active_window
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to change the active (focused) window.

Parameters:

  | window | the id of the window to activate
  | src | the source from which the request came
  | timestamp | the timestamp of the user action causing this request
  | active_window | active window of the requesting application, if any

changeCurrentDesktop | ( | self, |
|  | int | desktop
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to change the current desktop.

Parameters:

  | desktop | the number of the desktop

changeDesktopGeometry | ( | self, |
|  | int | desktop,
|  | NETSize | geom
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to change the specified desktop geometry.

Parameters:

  | desktop | the number of the desktop
  | geom | the new size

changeDesktopViewport | ( | self, |
|  | int | desktop,
|  | NETPoint | viewport
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to change the specified desktop viewport.

Parameters:

  | desktop | the number of the desktop
  | viewport | the new position of the viewport

changeNumberOfDesktops | ( | self, |
|  | int | numberOfDesktops
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to change the number of desktops.

Parameters:

  | numberOfDesktops | the new number of desktops

changeShowingDesktop | ( | self, |
|  | bool | showing
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a pager made a request to change showing the desktop. See _NET_SHOWING_DESKTOP for details.

Parameters:

  | showing | whether to activate the showing desktop mode

int clientListCount | ( |  | self ) |

Returns the number of managed windows in clientList array.

Returns:
  the number of managed windows in the clientList array

See also:
  clientList()

int clientListStackingCount | ( |  | self ) |

Returns the number of managed windows in the clientListStacking array.

Returns:
  the number of Window id's in the client list

See also:
  clientListStacking()

closeWindow | ( | self, |
|  | long | window
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to close a window.

Parameters:

  | window | the id of the window to close

closeWindowRequest | ( | self, |
|  | long | window
| ) |  |  |

Clients (such as pagers/taskbars) that wish to close a window should call this function. This will send a request to the Window Manager, which usually can usually decide how to react to such requests.

Parameters:

  | window | the id of the window to close

int currentDesktop | ( | self, |
|  | bool | ignore_viewport=0
| ) |  |  |

Returns the current desktop.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. They are however mapped to virtual desktops if needed.

Parameters:

  | ignore_viewport | if false, viewport is mapped to virtual desktops

Returns:
  the number of the current desktop

NETSize desktopGeometry | ( | self, |
|  | int | desktop
| ) |  |  |

Returns the desktop geometry size.

The desktop argument is ignored. Early drafts of the NET WM Specification were unclear about the semantics of this property.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. You should use calls for virtual desktops, viewport is mapped to them if needed.

Parameters:

  | desktop | the number of the desktop

Returns:
  the size of the desktop

QSize desktopLayoutColumnsRows | ( |  | self ) |

Returns the desktop layout number of columns and rows. Note that either may be 0 (see _NET_DESKTOP_LAYOUT).

NET.DesktopLayoutCorner desktopLayoutCorner | ( |  | self ) |

Returns the desktop layout starting corner.

NET.Orientation desktopLayoutOrientation | ( |  | self ) |

Returns the desktop layout orientation.

QString desktopName | ( | self, |
|  | int | desktop
| ) |  |  |

Returns the name for the specified desktop.

Parameters:

  | desktop | the number of the desktop

Returns:
  the name of the desktop

NETPoint desktopViewport | ( | self, |
|  | int | desktop
| ) |  |  |

Returns the viewport of the specified desktop.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. You should use calls for virtual desktops, viewport is mapped to them if needed.

Parameters:

  | desktop | the number of the desktop

Returns:
  the position of the desktop's viewport

gotPing | ( | self, |
|  | long | window,
|  | long | timestamp
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive replies to the _NET_WM_PING protocol.

Parameters:

  | window | the window from which the reply came
  | timestamp | timestamp of the ping

gotTakeActivity | ( | self, |
|  | long | window,
|  | long | timestamp,
|  | long | flags
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to receive replies to the _NET_WM_TAKE_ACTIVITY protocol.

Parameters:

  | window | the window from which the reply came
  | timestamp | timestamp of the ping
  | flags | flags passed in the original message

bool isSupported | ( | self, |
|  | NET.Property | property
| ) |  |  |

bool isSupported | ( | self, |
|  | NET.Property2 | property
| ) |  |  |

bool isSupported | ( | self, |
|  | NET.WindowType | type
| ) |  |  |

bool isSupported | ( | self, |
|  | NET.State | state
| ) |  |  |

bool isSupported | ( | self, |
|  | NET.Action | action
| ) |  |  |

moveResize | ( | self, |
|  | long | window,
|  | int | x_root,
|  | int | y_root,
|  | long | direction
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to start a move/resize.

Parameters:

  | window | The window that wants to move/resize
  | x_root | X position of the cursor relative to the root window.
  | y_root | Y position of the cursor relative to the root window.
  | direction | One of NET.Direction (see base class documentation for a description of the different directions).

moveResizeRequest | ( | self, |
|  | long | window,
|  | int | x_root,
|  | int | y_root,
|  | NET.Direction | direction
| ) |  |  |

Clients (such as pagers/taskbars) that wish to start a WMMoveResize (where the window manager controls the resize/movement, i.e. _NET_WM_MOVERESIZE) should call this function. This will send a request to the Window Manager.

Parameters:

  | window | The client window that would be resized/moved.
  | x_root | X position of the cursor relative to the root window.
  | y_root | Y position of the cursor relative to the root window.
  | direction | One of NET.Direction (see base class documentation for a description of the different directions).

moveResizeWindow | ( | self, |
|  | long | window,
|  | int | flags,
|  | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a pager made a request to move/resize a window. See _NET_MOVERESIZE_WINDOW for details.

Parameters:

  | window | the id of the window to more/resize
  | flags | Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
  | x | Requested X position for the window
  | y | Requested Y position for the window
  | width | Requested width for the window
  | height | Requested height for the window

moveResizeWindowRequest | ( | self, |
|  | long | window,
|  | int | flags,
|  | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |  |

Clients (such as pagers/taskbars) that wish to move/resize a window using WM2MoveResizeWindow (_NET_MOVERESIZE_WINDOW) should call this function. This will send a request to the Window Manager. See _NET_MOVERESIZE_WINDOW description for details.

Parameters:

  | window | The client window that would be resized/moved.
  | flags | Flags specifying the operation (see _NET_MOVERESIZE_WINDOW description)
  | x | Requested X position for the window
  | y | Requested Y position for the window
  | width | Requested width for the window
  | height | Requested height for the window

int numberOfDesktops | ( | self, |
|  | bool | ignore_viewport=0
| ) |  |  |

Returns the number of desktops.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. They are however mapped to virtual desktops if needed.

Parameters:

  | ignore_viewport | if false, viewport is mapped to virtual desktops

Returns:
  the number of desktops

removeClient | ( | self, |
|  | long | window
| ) |  |  |

A Client should subclass NETRootInfo and reimplement this function when it wants to know when a window has been removed.

Parameters:

  | window | the id of the window to remove

restackRequest | ( | self, |
|  | long | window,
|  | NET.RequestSource | source,
|  | long | above,
|  | int | detail,
|  | long | timestamp
| ) |  |  |

Sends the _NET_RESTACK_WINDOW request.

restackWindow | ( | self, |
|  | long | window,
|  | NET.RequestSource | source,
|  | long | above,
|  | int | detail,
|  | long | timestamp
| ) |  |  |

A Window Manager should subclass NETRootInfo and reimplement this function when it wants to know when a Client made a request to restack a window. See _NET_RESTACK_WINDOW for details.

Parameters:

  | window | the id of the window to restack
  | source | the source of the request
  | above | other window in the restack request
  | detail | restack detail
  | timestamp | the timestamp of the request

long rootWindow | ( |  | self ) |

Returns the Window id of the rootWindow.

Returns:
  the id of the root window

int screenNumber | ( |  | self ) |

Returns the screenNumber.

Returns:
  the screen number

sendPing | ( | self, |
|  | long | window,
|  | long | timestamp
| ) |  |  |

Sends a ping with the given timestamp to the window, using the _NET_WM_PING protocol.

setActiveWindow | ( | self, |
|  | long | window,
|  | NET.RequestSource | src,
|  | long | timestamp,
|  | long | active_window
| ) |  |  |

Sets the active (focused) window the specified window. This should be used only in the window manager mode.

Parameters:

  | window | the if of the new active window

setActiveWindow | ( | self, |
|  | long | window
| ) |  |  |

Sets the active (focused) window the specified window. This should be used only in the window manager mode.

Parameters:

  | window | the if of the new active window

setClientList | ( | self, |
|  | long | windows,
|  | long | count
| ) |  |  |

Sets the list of managed windows on the Root/Desktop window.

Parameters:

  | windows | The array of Window id's
  | count | The number of windows in the array

setClientListStacking | ( | self, |
|  | long | windows,
|  | long | count
| ) |  |  |

Sets the list of managed windows in stacking order on the Root/Desktop window.

Parameters:

  | windows | The array of Window id's
  | count | The number of windows in the array.

setCurrentDesktop | ( | self, |
|  | int | desktop,
|  | bool | ignore_viewport=0
| ) |  |  |

Sets the current desktop to the specified desktop.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. It is however mapped to virtual desktops if needed.

Parameters:

  | desktop | the number of the desktop
  | ignore_viewport | if false, viewport is mapped to virtual desktops

setDesktopGeometry | ( | self, |
|  | int | desktop,
|  | NETSize | geometry
| ) |  |  |

Sets the desktop geometry to the specified geometry.

The desktop argument is ignored. Early drafts of the NET WM Specification were unclear about the semantics of this property.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. You should use calls for virtual desktops, viewport is mapped to them if needed.

Parameters:

  | desktop | the number of the desktop
  | geometry | the new size of the desktop

setDesktopLayout | ( | self, |
|  | NET.Orientation | orientation,
|  | int | columns,
|  | int | rows,
|  | NET.DesktopLayoutCorner | corner
| ) |  |  |

Sets the desktop layout. This is set by the pager. When setting, the pager must own the _NET_DESKTOP_LAYOUT_Sn manager selection. See _NET_DESKTOP_LAYOUT for details.

setDesktopName | ( | self, |
|  | int | desktop,
|  | QString | desktopName
| ) |  |  |

Sets the name of the specified desktop.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. Viewport is mapped to virtual desktops if needed, but not for this call.

Parameters:

  | desktop | the number of the desktop
  | desktopName | the new name of the desktop

setDesktopViewport | ( | self, |
|  | int | desktop,
|  | NETPoint | viewport
| ) |  |  |

Sets the viewport for the current desktop to the specified point.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. You should use calls for virtual desktops, viewport is mapped to them if needed.

Parameters:

  | desktop | the number of the desktop
  | viewport | the new position of the desktop's viewport

setNumberOfDesktops | ( | self, |
|  | int | numberOfDesktops
| ) |  |  |

Sets the number of desktops to the specified number.

NOTE: KDE uses virtual desktops and does not directly support viewport in any way. Viewport is mapped to virtual desktops if needed, but not for this call.

Parameters:

  | numberOfDesktops | the number of desktops

setShowingDesktop | ( | self, |
|  | bool | showing
| ) |  |  |

Sets the _NET_SHOWING_DESKTOP status (whether desktop is being shown).

setSupported | ( | self, |
|  | NET.Property | property,
|  | bool | on=1
| ) |  |  |

Since:
  4.4

setSupported | ( | self, |
|  | NET.Property2 | property,
|  | bool | on=1
| ) |  |  |

Since:
  4.4

setSupported | ( | self, |
|  | NET.WindowType | property,
|  | bool | on=1
| ) |  |  |

Since:
  4.4

setSupported | ( | self, |
|  | NET.State | property,
|  | bool | on=1
| ) |  |  |

Since:
  4.4

setSupported | ( | self, |
|  | NET.Action | property,
|  | bool | on=1
| ) |  |  |

Since:
  4.4

setVirtualRoots | ( | self, |
|  | long | windows,
|  | long | count
| ) |  |  |

Sets the list of virtual root windows on the root window.

Parameters:

  | windows | The array of Window id's
  | count | The number of windows in the array.

setWorkArea | ( | self, |
|  | int | desktop,
|  | NETRect | workArea
| ) |  |  |

Sets the workarea for the specified desktop

Parameters:

  | desktop | the number of the desktop
  | workArea | the new work area of the desktop

bool showingDesktop | ( |  | self ) |

Returns the status of _NET_SHOWING_DESKTOP.

long supportWindow | ( |  | self ) |

Returns the Window id of the supportWindow.

Returns:
  the id of the support window

takeActivity | ( | self, |
|  | long | window,
|  | long | timestamp,
|  | long | flags
| ) |  |  |

Sends a take activity message with the given timestamp to the window, using the _NET_WM_TAKE_ACTIVITY protocol (see the WM spec for details).

Parameters:

  | window | the window to which the message should be sent
  | timestamp | timestamp of the message
  | flags | arbitrary flags

int virtualRootsCount | ( |  | self ) |

Returns the number of window in the virtualRoots array.

Returns:
  the number of Window id's in the virtual root array

See also:
  virtualRoots()

QString wmName | ( |  | self ) |

Returns the name of the Window Manager.

Returns:
  the name of the window manager

NETRect workArea | ( | self, |
|  | int | desktop
| ) |  |  |

Returns the workArea for the specified desktop.

Parameters:

  | desktop | the number of the desktop

Returns:
  the size of the work area

Display x11Display | ( |  | self ) |

Returns the X11 Display struct used.

Returns:
  the X11 Display

## Enumeration Documentation

anonymous

Indexes for the properties array.

Enumerator:

  PROTOCOLS |
  WINDOW_TYPES |
  STATES |
  PROTOCOLS2 |
  ACTIONS |
  PROPERTIES_SIZE |