[plasma/plasma-desktop] applets/taskmanager/qml: applets/taskmanager: Improve tooltip label insets when thumbnails are present

Nate Graham <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c568380abf76e1aa6c42fbde5b17ebb5440cc182 by Nate Graham, on behalf of Michal Malinowski.
Committed on 03/08/2026 at 21:03.
Pushed by ngraham into branch 'master'.

applets/taskmanager: Improve tooltip label insets when thumbnails are present

The task manager tooltip header (app name, window title, and close button)
loses its horizontal padding whenever a window thumbnail is displayed.
Hovering a pinned launcher shows the labels with the expected margins, but
hovering a running window renders the same labels flush against the tooltip
edge, so the two states look inconsistent and the text appears misaligned
against the thumbnail below it.

The horizontal inset is now applied unconditionally, restoring the labels to
the same alignment used elsewhere in the tooltip, while the vertical margin
keeps its existing thumbnail-dependent behaviour so the preview still meets
the header without a gap. The close button's margins, which were derived
from the old combined value, are updated to reference the new properties so
its position is unchanged.

BUG: 523809

M  +10   -0    applets/taskmanager/qml/ToolTipInstance.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/c568380abf76e1aa6c42fbde5b17ebb5440cc182

diff --git a/applets/taskmanager/qml/ToolTipInstance.qml b/applets/taskmanager/qml/ToolTipInstance.qml
index 91ee8c229c..366b0aa222 100644
--- a/applets/taskmanager/qml/ToolTipInstance.qml
+++ b/applets/taskmanager/qml/ToolTipInstance.qml
@@ -90,6 +90,12 @@ ColumnLayout {
         // match margins of DefaultToolTip.qml in plasma-framework
         Layout.margins: toolTipDelegate.isWin && Plasmoid.configuration.showToolTips ? 0 : Kirigami.Units.gridUnit / 2
 
+        // With thumbnails the header has no margins, so that the thumbnail below it
+        // can span the entire width of the tooltip. That leaves the text labels flush
+        // against the tooltip's edges, so inset them by the same amount the thumbnail
+        // is, to line them up
+        readonly property int labelInset: toolTipDelegate.isWin && Plasmoid.configuration.showToolTips ? pipeWireLoader.anchors.margins : 0
+
         RowLayout {
             id: header
             width: parent.width
@@ -110,6 +116,10 @@ ColumnLayout {
             // all textlabels
             ColumnLayout {
                 spacing: 0
+                // Keep the inset on the side away from the close button, which is meant to sit in the corner
+                Layout.leftMargin: closeButtonFlippedItemProxy.visible ? 0 : headerItem.labelInset
+                Layout.rightMargin: closeButtonFlippedItemProxy.visible ? headerItem.labelInset : 0
+                Layout.topMargin: headerItem.labelInset
                 // app name
                 Kirigami.Heading {
                     id: appNameHeading
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.