NET Class

Base namespace class. More...

Header: #include <NET>
CMake: find_package(KF6 REQUIRED COMPONENTS KWindowSystem)
target_link_libraries(mytarget PRIVATE KF6::KWindowSystem)

Public Types

enum Action { ActionMove, ActionResize, ActionMinimize, ActionShade, ActionStick, …, ActionClose }
flags Actions
enum DesktopLayoutCorner { DesktopLayoutCornerTopLeft, DesktopLayoutCornerTopRight, DesktopLayoutCornerBottomLeft, DesktopLayoutCornerBottomRight }
enum Direction { TopLeft, Top, TopRight, Right, BottomRight, …, MoveResizeCancel }
enum MappingState { Visible, Withdrawn, Iconic }
enum Orientation { OrientationHorizontal, OrientationVertical }
enum Property2 { WM2UserTime, WM2StartupId, WM2TransientFor, WM2GroupLeader, WM2AllowedActions, …, WM2AllProperties }
flags Properties2
flags Properties
enum Property { WMAllProperties, Supported, ClientList, ClientListStacking, NumberOfDesktops, …, XAWMState }
(since 5.3) enum Protocol { NoProtocol, TakeFocusProtocol, DeleteWindowProtocol, PingProtocol, SyncRequestProtocol, ContextHelpProtocol }
flags Protocols
enum RequestSource { FromUnknown, FromApplication, FromTool }
enum Role { Client, WindowManager }
enum State { Modal, Sticky, MaxVert, MaxHoriz, Max, …, Focused }
flags States
enum WindowType { Unknown, Normal, Desktop, Dock, Toolbar, …, AppletPopup }
enum WindowTypeMask { NormalMask, DesktopMask, DockMask, ToolbarMask, MenuMask, …, AllTypesMask }
flags WindowTypes

Static Public Members

int timestampCompare(unsigned long time1, unsigned long time2)
int timestampDiff(unsigned long time1, unsigned long time2)
bool typeMatchesMask(NET::WindowType type, NET::WindowTypes mask)

Detailed Description

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 https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html.

Member Type Documentation

enum NET::Action
flags NET::Actions

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

ConstantValue
NET::ActionMove1u << 0
NET::ActionResize1u << 1
NET::ActionMinimize1u << 2
NET::ActionShade1u << 3
NET::ActionStick1u << 4
NET::ActionMaxVert1u << 5
NET::ActionMaxHoriz1u << 6
NET::ActionMaxActionMaxVert | ActionMaxHoriz
NET::ActionFullScreen1u << 7
NET::ActionChangeDesktop1u << 8
NET::ActionClose1u << 9

The Actions type is a typedef for QFlags<Action>. It stores an OR combination of Action values.

enum NET::DesktopLayoutCorner

Starting corner for desktop layout.

ConstantValue
NET::DesktopLayoutCornerTopLeft0
NET::DesktopLayoutCornerTopRight1
NET::DesktopLayoutCornerBottomLeft2
NET::DesktopLayoutCornerBottomRight3

enum NET::Direction

Direction for WMMoveResize.

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

ConstantValueDescription
NET::TopLeft0 
NET::Top1 
NET::TopRight2 
NET::Right3 
NET::BottomRight4 
NET::Bottom5 
NET::BottomLeft6 
NET::Left7 
NET::Move8For movement only.
NET::KeyboardSize9Resizing via keyboard.
NET::KeyboardMove10Movement via keyboard.
NET::MoveResizeCancel11To ask the WM to stop moving a window.

enum NET::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.

ConstantValueDescription
NET::Visible1Indicates the client window is visible to the user.
NET::Withdrawn0Indicates that neither the client window nor its icon is visible.
NET::Iconic3Indicates that the client window is not visible, but its icon is. This can be when the window is minimized or when it's on a different virtual desktop. See also NET::Hidden.

enum NET::Orientation

Orientation.

ConstantValue
NET::OrientationHorizontal0
NET::OrientationVertical1

enum NET::Property2
flags NET::Properties2

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

Client window properties and protocols:

ConstantValueDescription
NET::WM2UserTime1u << 0 
NET::WM2StartupId1u << 1 
NET::WM2TransientFor1u << 2Main window for the window (WM_TRANSIENT_FOR).
NET::WM2GroupLeader1u << 3Group leader (window_group in WM_HINTS).
NET::WM2AllowedActions1u << 4 
NET::WM2RestackWindow1u << 5 
NET::WM2MoveResizeWindow1u << 6 
NET::WM2ExtendedStrut1u << 7 
NET::WM2KDETemporaryRules1u << 8Non-standard.
NET::WM2WindowClass1u << 9WM_CLASS
NET::WM2WindowRole1u << 10WM_WINDOW_ROLE
NET::WM2ClientMachine1u << 11WM_CLIENT_MACHINE
NET::WM2ShowingDesktop1u << 12 
NET::WM2Opacity1u << 13_NET_WM_WINDOW_OPACITY
NET::WM2DesktopLayout1u << 14_NET_DESKTOP_LAYOUT
NET::WM2FullPlacement1u << 15_NET_WM_FULL_PLACEMENT
NET::WM2FullscreenMonitors1u << 16_NET_WM_FULLSCREEN_MONITORS
NET::WM2FrameOverlap1u << 17Non-standard.
NET::WM2Activities (since Qt 4.6)1u << 18Non-standard.
NET::WM2BlockCompositing (since Qt 4.7)1u << 19Standard since 5.17.
NET::WM2KDEShadow (since Qt 4.7)1u << 20Non-standard.
NET::WM2Urgency (since Qt 5.3)1u << 21Urgency hint in WM_HINTS (see ICCCM 4.1.2.4).
NET::WM2Input (since Qt 5.3)1u << 22Input hint (input in WM_HINTS, see ICCCM 4.1.2.4).
NET::WM2Protocols (since Qt 5.3)1u << 23See NET::Protocol.
NET::WM2InitialMappingState (since Qt 5.5)1u << 24Initial state hint of WM_HINTS (see ICCCM 4.1.2.4).
NET::WM2IconPixmap (since Qt 5.7)1u << 25Icon pixmap and mask in WM_HINTS (see ICCCM 4.1.2.4).
NET::WM2OpaqueRegion (since Qt 5.7)1u << 25 
NET::WM2DesktopFileName (since Qt 5.28)1u << 26Non-standard. The base name of the desktop file name or the full path to the desktop file.
NET::WM2GTKFrameExtents (since Qt 5.65)1u << 27Non-standard. Extents of the shadow drawn by the client.
NET::WM2AppMenuServiceName (since Qt 5.69)1u << 28. Non-standard.
NET::WM2AppMenuObjectPath (since Qt 5.69)1u << 29. Non-standard.
NET::WM2GTKApplicationId (since Qt 5.91)1u << 30Non-standard. _GTK_APPLICATION_ID
NET::WM2GTKShowWindowMenu (since Qt 5.96)1u << 31Non-standard. _GTK_SHOW_WINDOW_MENU
NET::WM2AllProperties~0u 

The Properties2 type is a typedef for QFlags<Property2>. It stores an OR combination of Property2 values.

enum NET::Property
flags NET::Properties

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

ConstantValueDescription
NET::WMAllProperties~0uRoot/Desktop window properties and protocols:
NET::Supported1u << 0 
NET::ClientList1u << 1 
NET::ClientListStacking1u << 2 
NET::NumberOfDesktops1u << 3 
NET::DesktopGeometry1u << 4 
NET::DesktopViewport1u << 5 
NET::CurrentDesktop1u << 6 
NET::DesktopNames1u << 7 
NET::ActiveWindow1u << 8 
NET::WorkArea1u << 9 
NET::SupportingWMCheck1u << 10 
NET::VirtualRoots1u << 11 
NET::CloseWindow1u << 13 
NET::WMMoveResize1u << 14 

Client window properties and protocols:

ConstantValueDescription
NET::WMName1u << 15 
NET::WMVisibleName1u << 16 
NET::WMDesktop1u << 17 
NET::WMWindowType1u << 18 
NET::WMState1u << 19 
NET::WMStrut1u << 20Obsoleted by WM2ExtendedStrut.
NET::WMGeometry1u << 31 
NET::WMFrameExtents1u << 28 
NET::WMIconGeometry1u << 21 
NET::WMIcon1u << 22 
NET::WMIconName1u << 29 
NET::WMVisibleIconName1u << 30 
NET::WMHandledIcons1u << 24 
NET::WMPid1u << 23 
NET::WMPing1u << 25 

ICCCM properties (provided for convenience):

ConstantValue
NET::XAWMState1u << 27

The Properties type is a typedef for QFlags<Property>. It stores an OR combination of Property values.

[since 5.3] enum NET::Protocol
flags NET::Protocols

Protocols supported by the client. See ICCCM 4.1.2.7.

ConstantValueDescription
NET::NoProtocol0 
NET::TakeFocusProtocol1 << 0WM_TAKE_FOCUS
NET::DeleteWindowProtocol1 << 1WM_DELETE_WINDOW
NET::PingProtocol1 << 2_NET_WM_PING from EWMH
NET::SyncRequestProtocol1 << 3_NET_WM_SYNC_REQUEST from EWMH
NET::ContextHelpProtocol1 << 4Non-standard. _NET_WM_CONTEXT_HELP

This enum was introduced in 5.3.

The Protocols type is a typedef for QFlags<Protocol>. It stores an OR combination of Protocol values.

enum NET::RequestSource

Source of the request.

ConstantValueDescription
NET::FromUnknown0Indicates that the source of the request is unknown.
NET::FromApplication1Indicates that the request comes from a normal application.
NET::FromTool2Indicated that the request comes from pager or similar tool.

enum NET::Role

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

ConstantValueDescription
NET::Client0Indicates that the application is a client application.
NET::WindowManager1Indicates that the application is a window manager application.

enum NET::State
flags NET::States

Window state.

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

KX11Extras::setState( winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher );

for example to not show the window on the taskbar, desktop pager, or window switcher. 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.

ConstantValueDescription
NET::Modal1u << 0Indicates that this is a modal dialog box. The WM_TRANSIENT_FOR hint MUST be set to indicate which window the dialog is a modal for, or set to the root window if the dialog is a modal for its window group.
NET::Sticky1u << 1Indicates that the Window Manager SHOULD keep the window's position fixed on the screen, even when the virtual desktop scrolls. Note that this is different from being kept on all desktops.
NET::MaxVert1u << 2Indicates that the window is vertically maximized.
NET::MaxHoriz1u << 3Indicates that the window is horizontally maximized.
NET::MaxMaxVert | MaxHorizconvenience value. Equal to MaxVert | MaxHoriz.
NET::Shaded1u << 4Indicates that the window is shaded (rolled-up).
NET::SkipTaskbar1u << 5Indicates that a window should not be included on a taskbar.
NET::KeepAbove1u << 6Indicates that a window should on top of most windows (but below fullscreen windows).
NET::SkipPager1u << 7Indicates that a window should not be included on a pager.
NET::Hidden1u << 8Indicates that a window should not be visible on the screen (e.g. when minimised). Only the window manager is allowed to change it.
NET::FullScreen1u << 9Indicates that a window should fill the entire screen and have no window decorations.
NET::KeepBelow1u << 10Indicates that a window should be below most windows (but above any desktop windows).
NET::DemandsAttention1u << 11there was an attempt to activate this window, but the window manager prevented this. E.g. taskbar should mark such window specially to bring user's attention to this window. Only the window manager is allowed to change it.
NET::SkipSwitcher (since Qt 5.45)1u << 12Indicates that a window should not be included on a switcher.
NET::Focused (since Qt 5.58)1u << 13Indicates that a client should render as though it has focus Only the window manager is allowed to change it.

The States type is a typedef for QFlags<State>. It stores an OR combination of State values.

enum NET::WindowType

Window type.

ConstantValueDescription
NET::Unknown-1Indicates that the window did not define a window type.
NET::Normal0Indicates that this is a normal, top-level window.
NET::Desktop1Indicates a desktop feature. This can include a single window containing desktop icons with the sam*e dimensions as the screen, allowing the desktop environment to have full control of the desktop, without the need for proxying root window clicks.
NET::Dock2Indicates a dock or panel feature.
NET::Toolbar3Indicates a toolbar window.
NET::Menu4Indicates a pinnable (torn-off) menu window.
NET::Dialog5Indicates that this is a dialog window.
NET::Override6Non-standard. Deprecated: has unclear meaning and is KDE-only.
NET::TopMenu7Non-standard. Indicates a toplevel menu (AKA macmenu). This is a KDE extension to the _NET_WM_WINDOW_TYPE mechanism.
NET::Utility8Indicates a utility window.
NET::Splash9Indicates that this window is a splash screen window.
NET::DropdownMenu10Indicates a dropdown menu (from a menubar typically).
NET::PopupMenu11Indicates a popup menu (a context menu typically).
NET::Tooltip12Indicates a tooltip window.
NET::Notification13Indicates a notification window.
NET::ComboBox14Indicates that the window is a list for a combobox.
NET::DNDIcon15Indicates a window that represents the dragged object during DND operation.
NET::OnScreenDisplay (since Qt 5.6)16Non-standard. Indicates an On Screen Display window (such as volume feedback).
NET::CriticalNotification (since Qt 5.58)17Non-standard. Indicates a critical notification (such as battery is running out).
NET::AppletPopup18Non-standard. Indicates that this window is an applet.

See also NET::WindowTypeMask.

enum NET::WindowTypeMask
flags NET::WindowTypes

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

ConstantValueDescription
NET::NormalMask1u << 0 
NET::DesktopMask1u << 1 
NET::DockMask1u << 2 
NET::ToolbarMask1u << 3 
NET::MenuMask1u << 4 
NET::DialogMask1u << 5 
NET::OverrideMask1u << 6 
NET::TopMenuMask1u << 7 
NET::UtilityMask1u << 8 
NET::SplashMask1u << 9 
NET::DropdownMenuMask1u << 10 
NET::PopupMenuMask1u << 11 
NET::TooltipMask1u << 12 
NET::NotificationMask1u << 13 
NET::ComboBoxMask1u << 14 
NET::DNDIconMask1u << 15 
NET::OnScreenDisplayMask (since Qt 5.6)1u << 16Non-standard.
NET::CriticalNotificationMask (since Qt 5.58)1u << 17Non-standard.
NET::AppletPopupMask1u << 18Non-standard.
NET::AllTypesMask0U - 1All window types.

The WindowTypes type is a typedef for QFlags<WindowTypeMask>. It stores an OR combination of WindowTypeMask values.

See also NET::WindowType.

Member Function Documentation

[static] int NET::timestampCompare(unsigned long time1, unsigned 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.

[static] int NET::timestampDiff(unsigned long time1, unsigned long time2)

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

[static] bool NET::typeMatchesMask(NET::WindowType type, NET::WindowTypes mask)

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