KX11Extras
#include <kx11extras.h>
Public Types | |
enum | IconSource { NETWM = 1 , WMHints = 2 , ClassHint = 4 , XApp = 8 } |
Public Types inherited from QObject | |
typedef | QObjectList |
Properties | |
bool | compositingActive |
Properties inherited from QObject | |
objectName | |
Signals | |
void | activeWindowChanged (WId id) |
void | compositingChanged (bool enabled) |
void | currentDesktopChanged (int desktop) |
void | desktopNamesChanged () |
void | numberOfDesktopsChanged (int num) |
void | stackingOrderChanged () |
void | strutChanged () |
void | windowAdded (WId id) |
void | windowChanged (WId id, NET::Properties properties, NET::Properties2 properties2) |
void | windowRemoved (WId id) |
void | workAreaChanged () |
Static Public Member Functions | |
static void | activateWindow (WId win, long time=0) |
static WId | activeWindow () |
static void | clearState (WId win, NET::States state) |
static bool | compositingActive () |
static int | currentDesktop () |
static QString | desktopName (int desktop) |
static Q_INVOKABLE void | forceActiveWindow (QWindow *window, long time=0) |
static void | forceActiveWindow (WId win, long time=0) |
static bool | hasWId (WId id) |
static QPixmap | icon (WId win, int width, int height, bool scale, int flags) |
static QPixmap | icon (WId win, int width, int height, bool scale, int flags, NETWinInfo *info) |
static QPixmap | icon (WId win, int width=-1, int height=-1, bool scale=false) |
static bool | mapViewport () |
static void | minimizeWindow (WId win) |
static int | numberOfDesktops () |
static QString | readNameProperty (WId window, unsigned long atom) |
static KX11Extras * | self () |
static void | setCurrentDesktop (int desktop) |
static void | setDesktopName (int desktop, const QString &name) |
static void | setExtendedStrut (WId win, qreal left_width, qreal left_start, qreal left_end, qreal right_width, qreal right_start, qreal right_end, qreal top_width, qreal top_start, qreal top_end, qreal bottom_width, qreal bottom_start, qreal bottom_end) |
static void | setOnActivities (WId win, const QStringList &activities) |
static void | setOnAllDesktops (WId win, bool b) |
static void | setOnDesktop (WId win, int desktop) |
static void | setState (WId win, NET::States state) |
static void | setStrut (WId win, qreal left, qreal right, qreal top, qreal bottom) |
static void | setType (WId win, NET::WindowType windowType) |
static QList< WId > | stackingOrder () |
static void | unminimizeWindow (WId win) |
static QList< WId > | windows () |
static QRect | workArea (const QList< WId > &excludes, int desktop=-1) |
static QRect | workArea (int desktop=-1) |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
void | connectNotify (const QMetaMethod &signal) override |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Detailed Description
A collection of functions to obtain information from and manipulate X11 windows.
These are generally not applicable to other window systems
- Since
- 5.101
Definition at line 28 of file kx11extras.h.
Member Enumeration Documentation
◆ IconSource
Masks specifying from which sources to read an icon.
They are tried from the best until an icon is found.
- NETWM from property from the window manager specification
- WMHints from WMHints property
- ClassHint load icon after getting name from the classhint
- XApp load the standard X icon (last fallback)
Definition at line 217 of file kx11extras.h.
Property Documentation
◆ compositingActive
|
read |
Whether desktop compositing is active.
Definition at line 35 of file kx11extras.h.
Member Function Documentation
◆ activateWindow()
|
static |
Requests that window win
is activated.
There are two ways how to activate a window, by calling activateWindow() and forceActiveWindow(). Generally, applications shouldn't make attempts to explicitly activate their windows, and instead let the user to activate them. In the special cases where this may be needed, applications should use activateWindow(). Window manager may consider whether this request wouldn't result in focus stealing, which would be obtrusive, and may refuse the request.
The usage of forceActiveWindow() is meant only for pagers and similar tools, which represent direct user actions related to window manipulation. Except for rare cases, this request will be always honored, and normal applications are forbidden to use it.
In case of problems, consult the KWin README in the kdebase package (kdebase/kwin/README), or ask on the kwin@.nosp@m.kde..nosp@m.org mailing list.
- Parameters
-
win the id of the window to make active time X server timestamp of the user activity that caused this request
Definition at line 576 of file kx11extras.cpp.
◆ activeWindow()
|
static |
Returns the currently active window, or 0 if no window is active.
- Returns
- the window id of the active window, or 0 if no window is active
Definition at line 565 of file kx11extras.cpp.
◆ activeWindowChanged
|
signal |
Hint that <Window> is active (= has focus) now.
- Parameters
-
id the id of the window that is active
◆ clearState()
|
static |
Clears the state of window win
from state
.
Possible values are or'ed combinations of NET::Modal, NET::Sticky, NET::MaxVert, NET::MaxHoriz, NET::Shaded, NET::SkipTaskbar, NET::SkipPager, NET::Hidden, NET::FullScreen, NET::KeepAbove, NET::KeepBelow, NET::SkipSwitcher
- Parameters
-
win the id of the window state the flags that will be cleared
- Since
- 6.0
Definition at line 1181 of file kx11extras.cpp.
◆ compositingActive()
|
static |
Returns true if a compositing manager is running (i.e.
ARGB windows are supported, effects will be provided, etc.).
◆ compositingChanged
|
signal |
Compositing was enabled or disabled.
Note that this signal may be emitted before any compositing plugins have been initialized in the window manager.
If you need to check if a specific compositing plugin such as the blur effect is enabled, you should track that separately rather than test for it in a slot connected to this signal.
◆ connectNotify()
|
overrideprotectedvirtual |
Reimplemented from QObject.
Definition at line 1147 of file kx11extras.cpp.
◆ currentDesktop()
|
static |
Returns the current virtual desktop.
- Returns
- the current virtual desktop
Definition at line 614 of file kx11extras.cpp.
◆ currentDesktopChanged
|
signal |
Switched to another virtual desktop.
- Parameters
-
desktop the number of the new desktop
◆ desktopName()
|
static |
Returns the name of the specified desktop.
- Parameters
-
desktop the number of the desktop
- Returns
- the name of the desktop
Definition at line 981 of file kx11extras.cpp.
◆ desktopNamesChanged
|
signal |
Desktops have been renamed.
◆ forceActiveWindow() [1/2]
|
static |
Sets window win
to be the active window.
Note that this should be called only in special cases, applications shouldn't force themselves or other windows to be the active window. Generally, this call should used only by pagers and similar tools. See the explanation in the description of activateWindow().
- Parameters
-
win the window to make active time X server timestamp of the user activity that caused this request
- Since
- 6.0
Definition at line 596 of file kx11extras.cpp.
◆ forceActiveWindow() [2/2]
|
static |
Sets window win
to be the active window.
Note that this should be called only in special cases, applications shouldn't force themselves or other windows to be the active window. Generally, this call should used only by pagers and similar tools. See the explanation in description of activateWindow().
- Parameters
-
win the id of the window to make active time X server timestamp of the user activity that caused this request
Definition at line 586 of file kx11extras.cpp.
◆ hasWId()
|
static |
Test to see if id
still managed at present.
- Parameters
-
id the window id to test
- Returns
- true if the window id is still managed
Definition at line 552 of file kx11extras.cpp.
◆ icon() [1/3]
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Overloaded variant that allows specifying from which sources the icon should be read.
You should usually prefer the simpler variant which tries all possibilities to get an icon.
- Parameters
-
win the id of the window width the desired width, or -1 height the desired height, or -1 scale if true the icon will be scaled to the desired size. Otherwise the icon will not be modified. flags OR-ed flags from the IconSource enum
Definition at line 838 of file kx11extras.cpp.
◆ icon() [2/3]
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Overloaded variant that allows passing in the NETWinInfo to use for reading the information.
This variant is only useful on the X11 platform, other platforms do not use NETWinInfo and delegate to the variant without NETWinInfo. Though if compiled with X11 support the X11 variant is used on other platforms if info is not nullptr
. This can be used by applications using e.g. platform wayland but also connecting to an XServer.
The NETWinInfo must be constructed with property NET::WMIcon in order to use the IconSource flag NETWM. NET::WM2IconPixmap for IconSource flag WMHints and NET::WM2WindowClass for IconSource flag ClassHint.
- Parameters
-
win the id of the window width the desired width, or -1 height the desired height, or -1 scale if true the icon will be scaled to the desired size. Otherwise the icon will not be modified. flags OR-ed flags from the IconSource enum into the NETWinInfo to use for reading properties.
Definition at line 845 of file kx11extras.cpp.
◆ icon() [3/3]
|
static |
Returns an icon for window win
.
If width
and height
are specified, the best icon for the requested size is returned.
If scale
is true, the icon is smooth-scaled to have exactly the requested size.
- Parameters
-
win the id of the window width the desired width, or -1 height the desired height, or -1 scale if true the icon will be scaled to the desired size. Otherwise the icon will not be modified.
- Returns
- the icon of the window
Definition at line 749 of file kx11extras.cpp.
◆ mapViewport()
|
static |
Returns true if viewports are mapped to virtual desktops.
Definition at line 1040 of file kx11extras.cpp.
◆ minimizeWindow()
|
static |
Minimizes the window with id win
.
On X11 this follows the protocol described in ICCCM section 4.1.4.
- Parameters
-
win The window to minimize
- See also
- unminimizeWindow()
Definition at line 868 of file kx11extras.cpp.
◆ numberOfDesktops()
|
static |
Returns the number of virtual desktops.
- Returns
- the number of virtual desktops
Definition at line 636 of file kx11extras.cpp.
◆ numberOfDesktopsChanged
|
signal |
The number of desktops changed.
- Parameters
-
num the new number of desktops
◆ readNameProperty()
|
static |
Function that reads and returns the contents of the given text property (WM_NAME, WM_ICON_NAME,...).
Definition at line 1015 of file kx11extras.cpp.
◆ self()
|
static |
Definition at line 539 of file kx11extras.cpp.
◆ setCurrentDesktop()
|
static |
Convenience function to set the current desktop to desktop
.
See NETRootInfo.
- Parameters
-
desktop the number of the new desktop
Definition at line 658 of file kx11extras.cpp.
◆ setDesktopName()
|
static |
Sets the name of the specified desktop.
- Parameters
-
desktop the number of the desktop name the new name for the desktop
Definition at line 997 of file kx11extras.cpp.
◆ setExtendedStrut()
|
static |
Sets the strut of window win
to left_width
ranging from left_start
to left_end
on the left edge, and simiarly for the other edges.
For not reserving a strut, pass 0 as the width. E.g. to reserve 10x10 square in the topleft corner, use e.g. setExtendedStrut( w, 10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 ).
- Parameters
-
win the id of the window left_width width of the strut at the left edge left_start starting y coordinate of the strut at the left edge left_end ending y coordinate of the strut at the left edge right_width width of the strut at the right edge right_start starting y coordinate of the strut at the right edge right_end ending y coordinate of the strut at the right edge top_width width of the strut at the top edge top_start starting x coordinate of the strut at the top edge top_end ending x coordinate of the strut at the top edge bottom_width width of the strut at the bottom edge bottom_start starting x coordinate of the strut at the bottom edge bottom_end ending x coordinate of the strut at the bottom edge
Definition at line 1084 of file kx11extras.cpp.
◆ setOnActivities()
|
static |
Moves window win
to activities activities
.
- Parameters
-
win the id of the window activities the list of activity UUIDs
- See also
- KWindowInfo::activities
Definition at line 742 of file kx11extras.cpp.
◆ setOnAllDesktops()
|
static |
Sets window win
to be present on all virtual desktops if is
true.
Otherwise the window lives only on one single desktop.
- Parameters
-
win the id of the window b true to show the window on all desktops, false otherwise
Definition at line 676 of file kx11extras.cpp.
◆ setOnDesktop()
|
static |
Moves window win
to desktop desktop
.
- Parameters
-
win the id of the window desktop the number of the new desktop
Definition at line 696 of file kx11extras.cpp.
◆ setState()
|
static |
Sets the state of window win
to state
.
Possible values are or'ed combinations of NET::Modal, NET::Sticky, NET::MaxVert, NET::MaxHoriz, NET::Shaded, NET::SkipTaskbar, NET::SkipPager, NET::Hidden, NET::FullScreen, NET::KeepAbove, NET::KeepBelow, NET::SkipSwitcher
- Parameters
-
win the id of the window state the new flags that will be set
- Since
- 6.0
Definition at line 1174 of file kx11extras.cpp.
◆ setStrut()
|
static |
Convenience function for setExtendedStrut() that automatically makes struts as wide/high as the screen width/height.
Sets the strut of window win
to left
, right
, top
, bottom
.
- Parameters
-
win the id of the window left the left strut right the right strut top the top strut bottom the bottom strut
Definition at line 1124 of file kx11extras.cpp.
◆ setType()
|
static |
Sets the type of window win
to windowType
.
- Parameters
-
win the id of the window windowType the type of the window (see NET::WindowType)
- Since
- 6.0
Definition at line 1167 of file kx11extras.cpp.
◆ stackingOrder()
|
static |
Returns the list of all toplevel windows currently managed by the window manager in the current stacking order (from lower to higher).
May be useful for pagers.
- Returns
- the list of all toplevel windows in stacking order
Definition at line 558 of file kx11extras.cpp.
◆ stackingOrderChanged
|
signal |
Emitted when the stacking order of the window changed.
The new order can be obtained with stackingOrder().
◆ strutChanged
|
signal |
Something changed with the struts, may or may not have changed the work area.
Usually just using the workAreaChanged() signal is sufficient.
◆ unminimizeWindow()
|
static |
Unminimizes the window with id win
.
On X11 this follows the protocol described in ICCCM section 4.1.4.
- Parameters
-
win The window to unminimize
- See also
- minimizeWindow()
Definition at line 890 of file kx11extras.cpp.
◆ windowAdded
|
signal |
A window has been added.
- Parameters
-
id the id of the window
◆ windowChanged
|
signal |
The window changed.
Carries the NET::Properties and NET::Properties2 that were changed.
- Parameters
-
id the id of the window properties the properties that were modified properties2 the properties2 that were modified
◆ windowRemoved
|
signal |
A window has been removed.
- Parameters
-
id the id of the window that has been removed
◆ windows()
|
static |
Returns the list of all toplevel windows currently managed by the window manager in the order of creation.
Please do not rely on indexes of this list: Whenever you enter Qt's event loop in your application, it may happen that entries are removed or added. Your module should perhaps work on a copy of this list and verify a window with hasWId() before any operations.
Iteration over this list can be done easily with
- Returns
- the list of all toplevel windows
Definition at line 545 of file kx11extras.cpp.
◆ workArea() [1/2]
Returns the workarea for the specified desktop, or the current work area if no desktop has been specified.
Excludes struts of clients in the exclude List.
- Parameters
-
excludes the list of clients whose struts will be excluded desktop the number of the desktop to check, -1 for the current desktop
- Returns
- the size and position of the desktop
Definition at line 913 of file kx11extras.cpp.
◆ workArea() [2/2]
|
static |
Returns the workarea for the specified desktop, or the current work area if no desktop has been specified.
- Parameters
-
desktop the number of the desktop to check, -1 for the current desktop
- Returns
- the size and position of the desktop
Definition at line 896 of file kx11extras.cpp.
◆ workAreaChanged
|
signal |
The workarea has changed.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:21 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.