From d6a6cf69f48fe48e2935a6c75c1aae5fd9c5b586 Mon Sep 17 00:00:00 2001 From: mx Date: Thu, 15 Oct 2026 23:50:24 +0200 Subject: [PATCH] Style in-window tooltips as glass instead of the stock Basic look Dock items, the launcher mode button and the settings hints used the attached ToolTip, which only gets the Basic style. GlassToolTip wraps ToolTip with a GlassPanel background, theme text and a Theme.duration fade, matching the bar's tooltip popout. Co-Authored-By: Claude Opus 5.5 --- quickshell/components/GlassToolTip.qml | 41 +++++++++++++++++++++ quickshell/dock/DockItem.qml | 10 +++-- quickshell/launcher/Launcher.qml | 8 ++-- quickshell/settings/controls/BarEditor.qml | 9 +++-- quickshell/settings/controls/SettingRow.qml | 9 +++-- quickshell/settings/pages/Appearance.qml | 9 +++-- 6 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 quickshell/components/GlassToolTip.qml diff --git a/quickshell/components/GlassToolTip.qml b/quickshell/components/GlassToolTip.qml new file mode 100644 index 0000000..8fe1f6a --- /dev/null +++ b/quickshell/components/GlassToolTip.qml @@ -0,0 +1,41 @@ +import QtQuick +import QtQuick.Controls +import "../theme" + +// In-window hover hint styled like the bar's tooltip popout. Declare it as a +// child of the hovered item instead of using the attached ToolTip, which only +// gets the stock Basic style. +ToolTip { + id: root + padding: 7 + leftPadding: 12 + rightPadding: 12 + y: -implicitHeight - 6 + font.pixelSize: 12 + contentItem: Text { + text: root.text + font: root.font + color: Theme.text + wrapMode: Text.Wrap + } + background: GlassPanel { + surfaceOpacity: Theme.panelOpacity + radius: Math.min(Theme.radius, height / 2) + } + enter: Transition { + NumberAnimation { + property: "opacity" + from: 0 + to: 1 + duration: Theme.duration / 2 + } + } + exit: Transition { + NumberAnimation { + property: "opacity" + from: 1 + to: 0 + duration: Theme.duration / 2 + } + } +} diff --git a/quickshell/dock/DockItem.qml b/quickshell/dock/DockItem.qml index adc8fbb..9bd7b62 100644 --- a/quickshell/dock/DockItem.qml +++ b/quickshell/dock/DockItem.qml @@ -1,5 +1,5 @@ import QtQuick -import QtQuick.Controls +import "../components" import "../services" import "../theme" @@ -133,7 +133,9 @@ Item { Accessible.role: Accessible.Button Accessible.name: group.name Accessible.onPressAction: DockState.click(group.id, root) - ToolTip.visible: options.tooltips && mouse.containsMouse && !DockState.opened && !dragging - ToolTip.delay: 500 - ToolTip.text: group.name + (group.windows.length ? " · " + group.windows.length + " window(s)" : group.entry ? "" : " · unavailable") + GlassToolTip { + visible: root.options.tooltips && mouse.containsMouse && !DockState.opened && !root.dragging + delay: 500 + text: root.group.name + (root.group.windows.length ? " · " + root.group.windows.length + " window(s)" : root.group.entry ? "" : " · unavailable") + } } diff --git a/quickshell/launcher/Launcher.qml b/quickshell/launcher/Launcher.qml index a9d9d71..d8bb179 100644 --- a/quickshell/launcher/Launcher.qml +++ b/quickshell/launcher/Launcher.qml @@ -258,9 +258,11 @@ PanelWindow { cursorShape: Qt.PointingHandCursor onClicked: root.toggleBrowse() } - ToolTip.visible: browseArea.containsMouse - ToolTip.delay: 600 - ToolTip.text: root.clipboardMode || root.emojiMode ? "Back to search" : root.browsing ? "Hide applications" : "All applications" + GlassToolTip { + visible: browseArea.containsMouse + delay: 600 + text: root.clipboardMode || root.emojiMode ? "Back to search" : root.browsing ? "Hide applications" : "All applications" + } } TextField { id: search diff --git a/quickshell/settings/controls/BarEditor.qml b/quickshell/settings/controls/BarEditor.qml index 84b4cd9..5f2e063 100644 --- a/quickshell/settings/controls/BarEditor.qml +++ b/quickshell/settings/controls/BarEditor.qml @@ -1,7 +1,6 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts -import QtQuick.Controls import "../../components" import "../../core" import "../../services" @@ -209,9 +208,11 @@ Item { spacing:8 Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;elide:Text.ElideRight HoverHandler {id:labelHover} - ToolTip.visible:labelHover.hovered && !!optionRow.modelData.description - ToolTip.text:optionRow.modelData.description || "" - ToolTip.delay:600} + GlassToolTip { + visible: labelHover.hovered && !!optionRow.modelData.description + delay: 600 + text: optionRow.modelData.description || "" + }} GlassComboBox { objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key visible:optionRow.modelData.type==="choice" diff --git a/quickshell/settings/controls/SettingRow.qml b/quickshell/settings/controls/SettingRow.qml index af2f247..4621feb 100644 --- a/quickshell/settings/controls/SettingRow.qml +++ b/quickshell/settings/controls/SettingRow.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import QtQuick.Layouts import "../../components" import "../../core" @@ -144,9 +143,11 @@ Item { } Rectangle { objectName: "reset-" + root.setting - ToolTip.visible: resetArea.containsMouse - ToolTip.delay: 500 - ToolTip.text: "Reset to default" + GlassToolTip { + visible: resetArea.containsMouse + delay: 500 + text: "Reset to default" + } visible: root.modified implicitWidth: 26 implicitHeight: 26 diff --git a/quickshell/settings/pages/Appearance.qml b/quickshell/settings/pages/Appearance.qml index af66eba..e01f0bd 100644 --- a/quickshell/settings/pages/Appearance.qml +++ b/quickshell/settings/pages/Appearance.qml @@ -1,6 +1,5 @@ pragma ComponentBehavior: Bound import QtQuick -import QtQuick.Controls import QtQuick.Layouts import "../controls" import "../../components" @@ -185,9 +184,11 @@ ColumnLayout { color: modelData.value border.width: selected ? 2 : 1 border.color: selected ? Theme.accent : Theme.border - ToolTip.visible: swatchArea.containsMouse - ToolTip.delay: 400 - ToolTip.text: modelData.name + GlassToolTip { + visible: swatchArea.containsMouse + delay: 400 + text: swatch.modelData.name + } MouseArea { id: swatchArea anchors.fill: parent