From 43c2541ccd5489c67a0d92750adf49006a45473a Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 17:15:51 +0200 Subject: [PATCH] add hover glow to all bar modules --- modules/BarIcon.qml | 12 ++++++++++++ modules/BarLabel.qml | 20 ++++++++++++++++---- modules/BarSection.qml | 12 ++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/modules/BarIcon.qml b/modules/BarIcon.qml index e0033a9..b499106 100644 --- a/modules/BarIcon.qml +++ b/modules/BarIcon.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Effects import Quickshell import "." as M @@ -6,6 +7,7 @@ Text { id: root property string icon: "" property string tooltip: "" + property bool _hovered: false text: icon color: M.Theme.base05 @@ -13,8 +15,18 @@ Text { font.family: M.Theme.iconFontFamily verticalAlignment: Text.AlignVCenter + layer.enabled: _hovered + layer.effect: MultiEffect { + shadowEnabled: true + shadowColor: M.Theme.base05 + shadowBlur: 0.5 + shadowVerticalOffset: 0 + shadowHorizontalOffset: 0 + } + HoverHandler { onHoveredChanged: { + root._hovered = hovered; if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); diff --git a/modules/BarLabel.qml b/modules/BarLabel.qml index 5fe262b..4c96a54 100644 --- a/modules/BarLabel.qml +++ b/modules/BarLabel.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Effects import Quickshell import "." as M @@ -7,9 +8,14 @@ Text { property string label: "" property string tooltip: "" property string minText: "" + property bool _hovered: false text: label width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth + color: M.Theme.base05 + font.pixelSize: M.Theme.fontSize + font.family: M.Theme.fontFamily + verticalAlignment: Text.AlignVCenter TextMetrics { id: _minMetrics @@ -17,13 +23,19 @@ Text { font.pixelSize: root.font.pixelSize font.family: root.font.family } - color: M.Theme.base05 - font.pixelSize: M.Theme.fontSize - font.family: M.Theme.fontFamily - verticalAlignment: Text.AlignVCenter + + layer.enabled: _hovered + layer.effect: MultiEffect { + shadowEnabled: true + shadowColor: M.Theme.base05 + shadowBlur: 0.5 + shadowVerticalOffset: 0 + shadowHorizontalOffset: 0 + } HoverHandler { onHoveredChanged: { + root._hovered = hovered; if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); diff --git a/modules/BarSection.qml b/modules/BarSection.qml index 0602fb4..39753ed 100644 --- a/modules/BarSection.qml +++ b/modules/BarSection.qml @@ -1,13 +1,25 @@ import QtQuick +import QtQuick.Effects import Quickshell import "." as M Row { id: root property string tooltip: "" + property bool _hovered: false + + layer.enabled: _hovered + layer.effect: MultiEffect { + shadowEnabled: true + shadowColor: M.Theme.base05 + shadowBlur: 0.5 + shadowVerticalOffset: 0 + shadowHorizontalOffset: 0 + } HoverHandler { onHoveredChanged: { + root._hovered = hovered; if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);