From d89928abaa1cffd0d212c52bf5ad81e700da929b Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Sat, 24 Apr 2021 22:12:18 -0600 Subject: [PATCH] Disambiguate identical icons in Large Icons task switcher This commit makes use of the new hasIdenticalIcon property of the TabBox model so that the Large Icons Task Switcher can disambiguate identical icons. It does so by adding window thumbnails to any icons that are identical, which makes the visual representation seen by the user no longer identical. The icons in the Small Icons Task Switcher are too small for window thumbnails to be distinguishable, so they are not shown for that Task Switcher. --- windowswitchers/IconTabBox.qml | 13 +++++++++++++ windowswitchers/big_icons/contents/ui/main.qml | 1 + windowswitchers/small_icons/contents/ui/main.qml | 2 ++ 3 files changed, 16 insertions(+) diff --git a/windowswitchers/IconTabBox.qml b/windowswitchers/IconTabBox.qml index f1d2effb1..9d5447e51 100644 --- a/windowswitchers/IconTabBox.qml +++ b/windowswitchers/IconTabBox.qml @@ -9,6 +9,7 @@ import QtQuick 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kquickcontrolsaddons 2.0 +import org.kde.kwin 2.0 as KWin Item { id: iconsTabBox @@ -19,6 +20,8 @@ Item { iconsListView.incrementCurrentIndex(); } property int iconSize + property bool showThumbnailsForIdenticalIcons: true + property bool compositing: true property alias count: iconsListView.count property alias margins: hoverItem.margins property alias currentItem: iconsListView.currentItem @@ -57,6 +60,16 @@ Item { topMargin: hoverItem.margins.top bottomMargin: hoverItem.margins.bottom } + KWin.ThumbnailItem { + anchors.bottom: parent.bottom + anchors.right: parent.right + width: parent.width/2 + height: width + visible: iconsTabBox.showThumbnailsForIdenticalIcons + && model.hasIdenticalIcon + && iconsTabBox.compositing + wId: windowId + } } MouseArea { anchors.fill: parent diff --git a/windowswitchers/big_icons/contents/ui/main.qml b/windowswitchers/big_icons/contents/ui/main.qml index 81d2f0b58..1f593e090 100644 --- a/windowswitchers/big_icons/contents/ui/main.qml +++ b/windowswitchers/big_icons/contents/ui/main.qml @@ -38,6 +38,7 @@ KWin.Switcher { id: icons model: tabBox.model iconSize: PlasmaCore.Units.iconSizes.enormous + compositing: tabBox.compositing height: iconSize + icons.margins.top + icons.margins.bottom anchors { top: parent.top diff --git a/windowswitchers/small_icons/contents/ui/main.qml b/windowswitchers/small_icons/contents/ui/main.qml index ca3a20b19..7686e8240 100644 --- a/windowswitchers/small_icons/contents/ui/main.qml +++ b/windowswitchers/small_icons/contents/ui/main.qml @@ -36,6 +36,8 @@ KWin.Switcher { IconTabBox { id: icons model: tabBox.model + // These icons are too small for thumbnails to be distinguishable + showThumbnailsForIdenticalIcons: false iconSize: PlasmaCore.Units.iconSizes.small height: iconSize + icons.margins.top + icons.margins.bottom anchors { -- GitLab