a2n
May 3, 2025, 7:59am
1
Hello, I want to get the name of the current active window from my wallpaper plugin, so my first thought was to get it via kwin because I have everything via the Window
class: resourceName
, resourceClass
, windowRole
and all the type property like desktopWindow
and dock
and so on.
So I have imported org.kde.kwin
but when I restart the plugin I have the following error:
module "org.kde.kwin" is not installed
I imagine that since this plugin is not a Kwin Script this is “out of scope”. So what’s the solution here? The strict minimum I need is the name of the active window/dock/menu/toolbar…
a2n
May 5, 2025, 8:57pm
2
I finally found something, using directly task
Item:
import QtQuick
import QtQml.Models
import QtQuick.Window
import org.kde.taskmanager as TaskManager
import org.kde.kwindowsystem as Kwin
Item {
id: plasmaTasksItem
readonly property bool existsWindowActive: root.activeTaskItem && tasksRepeater.count > 0 && activeTaskItem.isActive
property Item activeTaskItem: null
TaskManager.TasksModel {
id: tasksModel
sortMode: TaskManager.TasksModel.SortVirtualDesktop
groupMode: TaskManager.TasksModel.GroupDisabled
activity: activityInfo.currentActivity
virtualDesktop: virtualDesktopInfo.currentDesktop
filterByVirtualDesktop: true
filterByActivity: true
filterByScreen: true
}
Item {
id: taskList
Repeater {
id: tasksRepeater
model: tasksModel
Item {
id: task
readonly property bool isActive: model.IsActive
readonly property string windowTitle: model.display
readonly property var windowTypes: model.windowTypes
onIsActiveChanged: {
console.log(JSON.stringify({
isActive: model.IsActive,
windowTitle: model.display,
windowTypes: model.windowTypes
}))
if (isActive) plasmaTasksItem.activeTaskItem = task
}
}
}
}
}
a2n
May 5, 2025, 9:07pm
3
Just for information model
object is build like that:
objectName:
index: 0
row: 0
column: 0
model: QQmlDMAbstractItemModelData(0x65015152a390)
hasModelChildren: false
modelData: undefined
: undefined
ChildCount: 0
SkipTaskbar: false
IsFullScreenable: true
IsLauncher: false
edit: undefined
HasLauncher: false
IsKeepAbove: false
IsFullScreen: false
IsResizable: true
GenericName: Terminal emulator
IsClosable: true
IsVirtualDesktopsChangeable: true
VirtualDesktops: 515c2340-8f5b-46bc-9683-bf340e29ee63
IsMovable: true
AppId: kitty.desktop
LauncherUrlWithoutIcon: applications:kitty.desktop
IsShadeable: false
statusTip: undefined
ScreenGeometry: QRect(0, 0, 2438, 1524)
IsDemandingAttention: false
LastActivated: Mon May 5 23:03:49 2025 GMT+0200
IsMaximizable: true
MimeData: {f4d9cc3b-3cbf-4fbe-9935-4cac0bf242e7}
Geometry: QRect(1444, 387, 960, 741)
WinIdList: {f4d9cc3b-3cbf-4fbe-9935-4cac0bf242e7}
IsShaded: false
IsActive: true
MimeType: windowsystem/winid+{6719867a-4445-44c5-bbeb-a1f08b6adb29}
toolTip: undefined
IsHidden: false
ApplicationMenuServiceName:
CanLaunchNewInstance: true
IsMinimizable: true
IsWindow: true
IsGroupParent: false
IsKeepBelow: false
decoration: QVariant(QIcon, QIcon("kitty",availableSizes[normal,Off]=QList(QSize(16, 16), QSize(22, 22), QSize(32, 32), QSize(48, 48), QSize(64, 64), QSize(128, 128), QSize(256, 256)),cacheKey=0x800000000))
IsGroupable: true
ApplicationMenuObjectPath:
IsStartup: false
IsMinimized: false
AppName: kitty
StackingOrder: 3
display: ~
AppPid: 6280
IsMaximized: false
SkipPager: false
LauncherUrl: applications:kitty.desktop
IsOnAllVirtualDesktops: false
whatsThis: undefined
Activities: 1f53dcd4-7929-4c6b-a5f5-1cadfc38d01b
objectNameChanged: function() { [native code] }
modelIndexChanged: function() { [native code] }
rowChanged: function() { [native code] }
columnChanged: function() { [native code] }
modelDataChanged: function() { [native code] }