Show window count indicator dots on dock icons

When multiple windows of the same application are open, each
dock icon displays a row of dots matching the sibling window
count. The active window's dots are bright; inactive siblings
are dimmed. Single-window apps show one dot as before.

Uses the TasksModel AppId role to count windows sharing the
same application identity.
This commit is contained in:
Marco Allegretti 2026-04-10 13:32:16 +02:00
parent 21201f1e32
commit eb33b533c6

View file

@ -131,6 +131,18 @@ MouseArea {
groupMode: TaskManager.TasksModel.GroupDisabled groupMode: TaskManager.TasksModel.GroupDisabled
} }
// Count how many windows share the same AppId as the task at the given index
function windowCountForTask(taskIndex) {
var appId = tasksModel.data(tasksModel.makeModelIndex(taskIndex), TaskManager.AbstractTasksModel.AppId)
if (!appId) return 1
var count = 0
for (var i = 0; i < tasksModel.rowCount(); i++) {
if (tasksModel.data(tasksModel.makeModelIndex(i), TaskManager.AbstractTasksModel.AppId) === appId)
count++
}
return count
}
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressAndHold: { onPressAndHold: {
@ -619,16 +631,24 @@ MouseArea {
active: taskMouseArea.containsMouse active: taskMouseArea.containsMouse
} }
// Active-window indicator dot // Window indicator dots (one per sibling window of the same app)
Rectangle { Row {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: Kirigami.Units.smallSpacing / 2 anchors.bottomMargin: Kirigami.Units.smallSpacing / 2
width: Kirigami.Units.smallSpacing * 2 spacing: Kirigami.Units.smallSpacing / 2
height: width
radius: width / 2 Repeater {
color: Kirigami.Theme.highlightColor model: root.windowCountForTask(taskDelegate.index)
visible: taskDelegate.model.IsActive === true
Rectangle {
width: Kirigami.Units.smallSpacing * 1.5
height: width
radius: width / 2
color: Kirigami.Theme.highlightColor
opacity: taskDelegate.model.IsActive === true ? 1.0 : 0.4
}
}
} }
// Click to activate, hover for thumbnail preview // Click to activate, hover for thumbnail preview