mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
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:
parent
21201f1e32
commit
eb33b533c6
1 changed files with 27 additions and 7 deletions
|
|
@ -131,6 +131,18 @@ MouseArea {
|
|||
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
|
||||
|
||||
onPressAndHold: {
|
||||
|
|
@ -619,16 +631,24 @@ MouseArea {
|
|||
active: taskMouseArea.containsMouse
|
||||
}
|
||||
|
||||
// Active-window indicator dot
|
||||
Rectangle {
|
||||
// Window indicator dots (one per sibling window of the same app)
|
||||
Row {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottomMargin: Kirigami.Units.smallSpacing / 2
|
||||
width: Kirigami.Units.smallSpacing * 2
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Kirigami.Theme.highlightColor
|
||||
visible: taskDelegate.model.IsActive === true
|
||||
spacing: Kirigami.Units.smallSpacing / 2
|
||||
|
||||
Repeater {
|
||||
model: root.windowCountForTask(taskDelegate.index)
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue