Plasma-workspace
xwindowtasksmodel.cpp
58 NET::WMState | NET::XAWMState | NET::WMDesktop | NET::WMVisibleName | NET::WMGeometry | NET::WMFrameExtents | NET::WMWindowType | NET::WMPid;
59static const NET::Properties2 windowInfoFlags2 = NET::WM2DesktopFileName | NET::WM2Activities | NET::WM2WindowClass | NET::WM2AllowedActions
156 for (const auto locations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation); const QString &location : locations) {
175 QObject::connect(windowSystem, &XWindowSystemEventBatcher::windowRemoved, q, [this](WId window) {
179 QObject::connect(windowSystem, &XWindowSystemEventBatcher::windowChanged, q, [this](WId window, NET::Properties properties, NET::Properties2 properties2) {
209 // No need to do anything if the model is empty. This avoids calling q->dataChanged with an invalid QModelIndex.
216 Q_EMIT q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0), QList<int>{StackingOrder});
234 KWindowInfo info(window, NET::WMWindowType | NET::WMState | NET::WMName | NET::WMVisibleName, NET::WM2TransientFor);
236 NET::WindowType wType = info.windowType(NET::NormalMask | NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
237 | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask | NET::NotificationMask);
242 if (leader > 0 && leader != window && leader != X11Info::appRootWindow() && !transients.contains(window) && windows.contains(leader)) {
255 if (wType != NET::Normal && wType != NET::Override && wType != NET::Unknown && wType != NET::Dialog && wType != NET::Utility) {
296void XWindowTasksModel::Private::transientChanged(WId window, NET::Properties properties, NET::Properties2 properties2)
336void XWindowTasksModel::Private::windowChanged(WId window, NET::Properties properties, NET::Properties2 properties2)
348 if (properties & (NET::WMPid) || properties2 & (NET::WM2DesktopFileName | NET::WM2WindowClass)) {
351 changedRoles << Qt::DecorationRole << AppId << AppName << GenericName << LauncherUrl << AppPid << SkipTaskbar << CanLaunchNewInstance;
498 icon.addPixmap(KX11Extras::icon(window, KIconLoader::SizeSmall, KIconLoader::SizeSmall, false));
499 icon.addPixmap(KX11Extras::icon(window, KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium, false));
500 icon.addPixmap(KX11Extras::icon(window, KIconLoader::SizeMedium, KIconLoader::SizeMedium, false));
501 icon.addPixmap(KX11Extras::icon(window, KIconLoader::SizeLarge, KIconLoader::SizeLarge, false));
553 return windowUrlFromMetadata(QString::fromLocal8Bit(info->windowClassClass()), info->pid(), rulesConfig, QString::fromLocal8Bit(info->windowClassName()));
596 uQuery.addQueryItem(QStringLiteral("iconData"), QString::fromLatin1(bytes.toBase64(QByteArray::Base64UrlEncoding)));
606 return ((windowInfo(window)->hasState(NET::DemandsAttention)) || transientsDemandingAttention.contains(window));
695 // The size belongs to the scaled coordinate system, which means the size is already divided by DPR
705 return (info->hasState(NET::SkipTaskbar) || info->windowType(NET::UtilityMask) == NET::Utility || d->appData(window).skipTaskbar);
776 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count() || urls.isEmpty()) {
795 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
816 ri.moveResizeRequest(window, geom.center().x(), geom.center().y(), NET::Move, XCB_BUTTON_INDEX_ANY);
821 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
842 ri.moveResizeRequest(window, geom.bottomRight().x(), geom.bottomRight().y(), NET::BottomRight, XCB_BUTTON_INDEX_ANY);
874 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
892 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::WMState, NET::Properties2());
907 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
914 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::WMState, NET::Properties2());
925 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
932 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::WMState, NET::Properties2());
943 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
950 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::WMState, NET::Properties2());
961 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
968 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::WMState, NET::Properties2());
977void XWindowTasksModel::requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops)
1040void XWindowTasksModel::requestActivities(const QModelIndex &index, const QStringList &activities)
1051void XWindowTasksModel::requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate)
1055 if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) {
1061 if (d->delegateGeometries.contains(window) && d->delegateGeometries.value(window) == geometry) {
1065 NETWinInfo ni(X11Info::connection(), window, X11Info::appRootWindow(), NET::Properties(), NET::Properties2());
static bool isDesktopFile(const QString &path)
void deleted(const QString &path)
void dirty(const QString &path)
void created(const QString &path)
SizeMedium
SizeSmallMedium
SizeSmall
SizeLarge
static Ptr serviceByStorageId(const QString &_storageId)
QExplicitlySharedDataPointer< KService > Ptr
static KSycoca * self()
Q_SIGNAL void databaseChanged()
bool isMinimized() const
int pid() const
bool valid(bool withdrawn_is_valid=false) const
QByteArray gtkApplicationId() const
QByteArray windowClassName() const
bool isOnCurrentDesktop() const
bool hasState(NET::States s) const
QByteArray applicationMenuServiceName() const
bool onAllDesktops() const
QRect geometry() const
NET::WindowType windowType(NET::WindowTypes supported_types) const
QByteArray desktopFileName() const
int desktop() const
QByteArray windowClassClass() const
QByteArray applicationMenuObjectPath() const
static QPixmap icon(WId win, int width, int height, bool scale, int flags)
static void setOnAllDesktops(WId win, bool b)
void activeWindowChanged(WId id)
static void minimizeWindow(WId win)
static int currentDesktop()
static int numberOfDesktops()
static void setCurrentDesktop(int desktop)
static void unminimizeWindow(WId win)
static QList< WId > stackingOrder()
static WId activeWindow()
static Q_INVOKABLE void forceActiveWindow(QWindow *window, long time=0)
static QList< WId > windows()
static void setOnActivities(WId win, const QStringList &activities)
void stackingOrderChanged()
static void setOnDesktop(WId win, int desktop)
void moveResizeRequest(xcb_window_t window, int x_root, int y_root, Direction direction, xcb_button_t button=XCB_BUTTON_INDEX_ANY, RequestSource source=RequestSource::FromUnknown)
void closeWindowRequest(xcb_window_t window)
void setNumberOfDesktops(int numberOfDesktops)
void setState(NET::States state, NET::States mask)
void setIconGeometry(NETRect geometry)
MaxHoriz
Max
Shaded
MaxVert
DemandsAttention
SkipTaskbar
FullScreen
KeepAbove
Hidden
SkipPager
KeepBelow
DialogMask
MenuMask
SplashMask
UtilityMask
OverrideMask
ToolbarMask
DockMask
NormalMask
DesktopMask
TopMenuMask
NotificationMask
WindowType
Override
Normal
Unknown
Dialog
Utility
QFlags< Property > Properties
QFlags< State > States
QFlags< Property2 > Properties2
A tasks model for X Window System windows.
Definition xwindowtasksmodel.h:39
void requestToggleMaximized(const QModelIndex &index) override
Request toggling the maximized state of the task at the given index.
Definition xwindowtasksmodel.cpp:872
static QList< WId > winIdsFromMimeData(const QMimeData *mimeData, bool *ok=nullptr)
Tries to extract X11 window ids from supplied mime data.
Definition xwindowtasksmodel.cpp:1109
void requestToggleShaded(const QModelIndex &index) override
Request toggling the shaded state of the task at the given index.
Definition xwindowtasksmodel.cpp:959
void requestNewInstance(const QModelIndex &index) override
Request an additional instance of the application owning the window at the given index.
Definition xwindowtasksmodel.cpp:765
void requestToggleMinimized(const QModelIndex &index) override
Request toggling the minimized state of the window at the given index.
Definition xwindowtasksmodel.cpp:845
void requestToggleKeepBelow(const QModelIndex &index) override
Request toggling the keep-below state of the task at the given index.
Definition xwindowtasksmodel.cpp:923
void requestVirtualDesktops(const QModelIndex &index, const QVariantList &desktops) override
Request entering the window at the given index on the specified virtual desktop.
Definition xwindowtasksmodel.cpp:977
void requestMove(const QModelIndex &index) override
Request starting an interactive move for the window at the given index.
Definition xwindowtasksmodel.cpp:793
static WId winIdFromMimeData(const QMimeData *mimeData, bool *ok=nullptr)
Tries to extract a X11 window id from supplied mime data.
Definition xwindowtasksmodel.cpp:1082
void requestActivities(const QModelIndex &index, const QStringList &activities) override
Request moving the task at the given index to the specified activities.
Definition xwindowtasksmodel.cpp:1040
void requestNewVirtualDesktop(const QModelIndex &index) override
Request entering the window at the given index on a new virtual desktop, which is created in response...
Definition xwindowtasksmodel.cpp:1020
void requestToggleKeepAbove(const QModelIndex &index) override
Request toggling the keep-above state of the task at the given index.
Definition xwindowtasksmodel.cpp:905
void requestOpenUrls(const QModelIndex &index, const QList< QUrl > &urls) override
Runs the application backing the launcher at the given index with the given URLs.
Definition xwindowtasksmodel.cpp:774
void requestPublishDelegateGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate=nullptr) override
Request informing the window manager of new geometry for a visual delegate for the window at the give...
Definition xwindowtasksmodel.cpp:1051
void requestToggleFullScreen(const QModelIndex &index) override
Request toggling the fullscreen state of the task at the given index.
Definition xwindowtasksmodel.cpp:941
void requestResize(const QModelIndex &index) override
Request starting an interactive resize for the window at the given index.
Definition xwindowtasksmodel.cpp:819
void requestActivate(const QModelIndex &index) override
Request activation of the window at the given index.
Definition xwindowtasksmodel.cpp:732
void requestClose(const QModelIndex &index) override
Request the window at the given index be closed.
Definition xwindowtasksmodel.cpp:783
KCALUTILS_EXPORT QString mimeType()
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
QVariant location(const QVariant &res)
QWidget * window(QObject *job)
virtual QMimeData * mimeData(const QModelIndexList &indexes) const const
Base64UrlEncoding
QByteArray toBase64(Base64Options options) const const
QDateTime currentDateTime()
bool exists(const QString &fileName)
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
WriteOnly
bool contains(const AT &value) const const
qsizetype indexOf(const AT &value, qsizetype from) const const
bool isEmpty() const const
bool isValid() const const
int row() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isNull() const const
bool save(QIODevice *device, const char *format, int quality) const const
int x() const const
int y() const const
QPoint bottomRight() const const
QPoint center() const const
int height() const const
bool isValid() const const
int width() const const
int x() const const
int y() const const
ConfigLocation
QStringList standardLocations(StandardLocation type)
QString & append(QChar ch)
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
QString fromLatin1(QByteArrayView str)
QString fromLocal8Bit(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
DecorationRole
Window
void timeout()
QUrl fromLocalFile(const QString &localFile)
bool isValid() const const
void setQuery(const QString &query, ParsingMode mode)
QString url(FormattingOptions options) const const
int x
int y
NETPoint pos
NETSize size
int height
int width
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:53 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:53 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.