KDE 4.7 PyKDE API Reference

- KDE's Python API

# NET Class Reference

`from PyKDE4.kdeui import *`

## Detailed Description

Base namespace class.

The NET API is an implementation of the NET Window Manager Specification.

This class is the base class for the NETRootInfo and NETWinInfo classes, which are used to retrieve and modify the properties of windows. To keep the namespace relatively clean, all enums are defined here.

See also:
  http://www.freedesktop.org/standards/wm-spec/

## Enumerations
<anonymous> | { OnAllDesktops }
Action | { ActionMove, ActionResize, ActionMinimize, ActionShade, ActionStick, ActionMaxVert, ActionMaxHoriz, ActionMax, ActionFullScreen, ActionChangeDesktop, ActionClose }
DesktopLayoutCorner | { DesktopLayoutCornerTopLeft, DesktopLayoutCornerTopRight, DesktopLayoutCornerBottomLeft, DesktopLayoutCornerBottomRight }
Direction | { TopLeft, Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, Move, KeyboardSize, KeyboardMove, MoveResizeCancel }
MappingState | { Visible, Withdrawn, Iconic }
Orientation | { OrientationHorizontal, OrientationVertical }
Property | { Supported, ClientList, ClientListStacking, NumberOfDesktops, DesktopGeometry, DesktopViewport, CurrentDesktop, DesktopNames, ActiveWindow, WorkArea, SupportingWMCheck, VirtualRoots, CloseWindow, WMMoveResize, WMName, WMVisibleName, WMDesktop, WMWindowType, WMState, WMStrut, WMIconGeometry, WMIcon, WMPid, WMHandledIcons, WMPing, XAWMState, WMFrameExtents, WMIconName, WMVisibleIconName, WMGeometry }
Property2 | { WM2UserTime, WM2StartupId, WM2TransientFor, WM2GroupLeader, WM2AllowedActions, WM2RestackWindow, WM2MoveResizeWindow, WM2ExtendedStrut, WM2TakeActivity, WM2KDETemporaryRules, WM2WindowClass, WM2WindowRole, WM2ClientMachine, WM2ShowingDesktop, WM2Opacity, WM2DesktopLayout, WM2FullPlacement, WM2FullscreenMonitors, WM2FrameOverlap, WM2Activities, WM2BlockCompositing, WM2KDEShadow }
RequestSource | { FromUnknown, FromApplication, FromTool }
Role | { Client, WindowManager }
State | { Modal, Sticky, MaxVert, MaxHoriz, Max, Shaded, SkipTaskbar, KeepAbove, StaysOnTop, SkipPager, Hidden, FullScreen, KeepBelow, DemandsAttention }
WindowType | { Unknown, Normal, Desktop, Dock, Toolbar, Menu, Dialog, Override, TopMenu, Utility, Splash, DropdownMenu, PopupMenu, Tooltip, Notification, ComboBox, DNDIcon }
WindowTypeMask | { NormalMask, DesktopMask, DockMask, ToolbarMask, MenuMask, DialogMask, OverrideMask, TopMenuMask, UtilityMask, SplashMask, DropdownMenuMask, PopupMenuMask, TooltipMask, NotificationMask, ComboBoxMask, DNDIconMask, AllTypesMask }
## Static Methods
int | timestampCompare (long time1, long time2)
int | timestampDiff (long time1, long time2)
bool | typeMatchesMask (NET.WindowType type, long mask)

## Static Method Documentation

int timestampCompare | ( | long | time1,
|  | long | time2
| ) |  |  |

Compares two X timestamps, taking into account wrapping and 64bit architectures. Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2.

Deprecated:
  Moved to KXUtils namespace.

int timestampDiff | ( | long | time1,
|  | long | time2
| ) |  |  |

Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1, as returned by timestampCompare().

Deprecated:
  Moved to KXUtils namespace.

bool typeMatchesMask | ( | NET.WindowType | type,
|  | long | mask
| ) |  |  |

Returns true if the given window type matches the mask given using WindowTypeMask flags.

## Enumeration Documentation

anonymous

Sentinel value to indicate that the client wishes to be visible on all desktops.

Enumerator:

  OnAllDesktops |

Action

Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).

Enumerator:

  ActionMove = 1<<0 |
  ActionResize = 1<<1 |
  ActionMinimize = 1<<2 |
  ActionShade = 1<<3 |
  ActionStick = 1<<4 |
  ActionMaxVert = 1<<5 |
  ActionMaxHoriz = 1<<6 |
  ActionMax = ActionMaxVert|ActionMaxHoriz |
  ActionFullScreen = 1<<7 |
  ActionChangeDesktop = 1<<8 |
  ActionClose = 1<<9 |

DesktopLayoutCorner

Starting corner for desktop layout.

Enumerator:

  DesktopLayoutCornerTopLeft = 0 |
  DesktopLayoutCornerTopRight = 1 |
  DesktopLayoutCornerBottomLeft = 2 |
  DesktopLayoutCornerBottomRight = 3 |

Direction

Direction for WMMoveResize.

When a client wants the Window Manager to start a WMMoveResize, it should specify one of:

- TopLeft
- Top
- TopRight
- Right
- BottomRight
- Bottom
- BottomLeft
- Left
- Move (for movement only)
- KeyboardSize (resizing via keyboard)
- KeyboardMove (movement via keyboard)

Enumerator:

  TopLeft = 0 |
  Top = 1 |
  TopRight = 2 |
  Right = 3 |
  BottomRight = 4 |
  Bottom = 5 |
  BottomLeft = 6 |
  Left = 7 |
  Move = 8 |
  KeyboardSize = 9 |
  KeyboardMove = 10 |
  MoveResizeCancel = 11 |

MappingState

Client window mapping state. The class automatically watches the mapping state of the client windows, and uses the mapping state to determine how to set/change different properties. Note that this is very lowlevel and you most probably don't want to use this state.

Enumerator:

  Visible = 1 |
  Withdrawn = 0 |
  Iconic = 3 |

Orientation

Orientation.

Enumerator:

  OrientationHorizontal = 0 |
  OrientationVertical = 1 |

Property

Supported properties. Clients and Window Managers must define which properties/protocols it wants to support.

Root/Desktop window properties and protocols:

- Supported
- ClientList
- ClientListStacking
- NumberOfDesktops
- DesktopGeometry
- DesktopViewport
- CurrentDesktop
- DesktopNames
- ActiveWindow
- WorkArea
- SupportingWMCheck
- VirtualRoots
- CloseWindow
- WMMoveResize

Client window properties and protocols:

- WMName
- WMVisibleName
- WMDesktop
- WMWindowType
- WMState
- WMStrut (obsoleted by WM2ExtendedStrut)
- WMGeometry
- WMFrameExtents
- WMIconGeometry
- WMIcon
- WMIconName
- WMVisibleIconName
- WMHandledIcons
- WMPid
- WMPing

ICCCM properties (provided for convenience):

- XAWMState

Enumerator:

  Supported = 1<<0 |
  ClientList = 1<<1 |
  ClientListStacking = 1<<2 |
  NumberOfDesktops = 1<<3 |
  DesktopGeometry = 1<<4 |
  DesktopViewport = 1<<5 |
  CurrentDesktop = 1<<6 |
  DesktopNames = 1<<7 |
  ActiveWindow = 1<<8 |
  WorkArea = 1<<9 |
  SupportingWMCheck = 1<<10 |
  VirtualRoots = 1<<11 |
  CloseWindow = 1<<13 |
  WMMoveResize = 1<<14 |
  WMName = 1<<15 |
  WMVisibleName = 1<<16 |
  WMDesktop = 1<<17 |
  WMWindowType = 1<<18 |
  WMState = 1<<19 |
  WMStrut = 1<<20 |
  WMIconGeometry = 1<<21 |
  WMIcon = 1<<22 |
  WMPid = 1<<23 |
  WMHandledIcons = 1<<24 |
  WMPing = 1<<25 |
  XAWMState = 1<<27 |
  WMFrameExtents = 1<<28 |
  WMIconName = 1<<29 |
  WMVisibleIconName = 1<<30 |
  WMGeometry = 1<<31 |

Property2

Supported properties. This enum is an extension to NET.Property, because them enum is limited only to 32 bits.

Client window properties and protocols:

- WM2UserTime
- WM2StartupId
- WM2TransientFor mainwindow for the window (WM_TRANSIENT_FOR)
- WM2GroupLeader group leader (window_group in WM_HINTS)
- WM2AllowedActions
- WM2RestackWindow
- WM2MoveResizeWindow
- WM2ExtendedStrut
- WM2TemporaryRules internal, for kstart
- WM2WindowClass WM_CLASS
- WM2WindowRole WM_WINDOW_ROLE
- WM2ClientMachine WM_CLIENT_MACHINE
- WM2ShowingDesktop
- WM2Opacity _NET_WM_WINDOW_OPACITY
- WM2DesktopLayout _NET_DESKTOP_LAYOUT
- WM2FullPlacement _NET_WM_FULL_PLACEMENT
- WM2FullscreenMonitors _NET_WM_FULLSCREEN_MONITORS

Enumerator:

  WM2UserTime = 1<<0 |
  WM2StartupId = 1<<1 |
  WM2TransientFor = 1<<2 |
  WM2GroupLeader = 1<<3 |
  WM2AllowedActions = 1<<4 |
  WM2RestackWindow = 1<<5 |
  WM2MoveResizeWindow = 1<<6 |
  WM2ExtendedStrut = 1<<7 |
  WM2TakeActivity = 1<<8 |
  WM2KDETemporaryRules = 1<<9 |
  WM2WindowClass = 1<<10 |
  WM2WindowRole = 1<<11 |
  WM2ClientMachine = 1<<12 |
  WM2ShowingDesktop = 1<<13 |
  WM2Opacity = 1<<14 |
  WM2DesktopLayout = 1<<15 |
  WM2FullPlacement = 1<<16 |
  WM2FullscreenMonitors = 1<<17 |
  WM2FrameOverlap = 1<<18 |
  WM2Activities = 1<<19 |
  WM2BlockCompositing = 1<<20 |
  WM2KDEShadow = 1<<21 |

RequestSource

Source of the request.

Enumerator:

  FromUnknown = 0 |
  FromApplication = 1 |
  FromTool = 2 |

Role

Application role. This is used internally to determine how several action should be performed (if at all).

Enumerator:

  Client |
  WindowManager |

State

Window state.

To set the state of a window, you'll typically do something like:

    KWindowSystem.setState( winId(), NET.SkipTaskbar | NET.SkipPager );

for example to not show the window on the taskbar and desktop pager. winId() is a function of QWidget()

Note that KeepAbove (StaysOnTop) and KeepBelow are meant as user preference and applications should avoid setting these states themselves.

Enumerator:

  Modal = 1<<0 |
  Sticky = 1<<1 |
  MaxVert = 1<<2 |
  MaxHoriz = 1<<3 |
  Max = MaxVert|MaxHoriz |
  Shaded = 1<<4 |
  SkipTaskbar = 1<<5 |
  KeepAbove = 1<<6 |
  StaysOnTop = KeepAbove |
  SkipPager = 1<<7 |
  Hidden = 1<<8 |
  FullScreen = 1<<9 |
  KeepBelow = 1<<10 |
  DemandsAttention = 1<<11 |

WindowType

Window type.

Enumerator:

  Unknown = -1 |
  Normal = 0 |
  Desktop = 1 |
  Dock = 2 |
  Toolbar = 3 |
  Menu = 4 |
  Dialog = 5 |
  Override = 6 |
  TopMenu = 7 |
  Utility = 8 |
  Splash = 9 |
  DropdownMenu = 10 |
  PopupMenu = 11 |
  Tooltip = 12 |
  Notification = 13 |
  ComboBox = 14 |
  DNDIcon = 15 |

WindowTypeMask

Values for WindowType when they should be OR'ed together, e.g. for the properties argument of the NETRootInfo constructor.

Enumerator:

  NormalMask = 1<<0 |
  DesktopMask = 1<<1 |
  DockMask = 1<<2 |
  ToolbarMask = 1<<3 |
  MenuMask = 1<<4 |
  DialogMask = 1<<5 |
  OverrideMask = 1<<6 |
  TopMenuMask = 1<<7 |
  UtilityMask = 1<<8 |
  SplashMask = 1<<9 |
  DropdownMenuMask = 1<<10 |
  PopupMenuMask = 1<<11 |
  TooltipMask = 1<<12 |
  NotificationMask = 1<<13 |
  ComboBoxMask = 1<<14 |
  DNDIconMask = 1<<15 |
  AllTypesMask = 0LU-1 |