From 4109078a9196dd039197031cec1196bc97c7e2b3 Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 17:28:03 +0200 Subject: [PATCH] fade in/out for dynamic modules, fix tray icon theming --- modules/Backlight.qml | 3 ++- modules/BarSection.qml | 2 ++ modules/Battery.qml | 3 ++- modules/Bluetooth.qml | 3 ++- modules/Mpris.qml | 3 ++- modules/Tray.qml | 10 +++++++--- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/modules/Backlight.qml b/modules/Backlight.qml index 91b4897..6ad1a52 100644 --- a/modules/Backlight.qml +++ b/modules/Backlight.qml @@ -5,7 +5,8 @@ import "." as M M.BarSection { id: root spacing: M.Theme.moduleSpacing - visible: M.Modules.backlight && percent > 0 + opacity: M.Modules.backlight && percent > 0 ? 1 : 0 + visible: opacity > 0 tooltip: "Brightness: " + root.percent + "%" property int percent: 0 diff --git a/modules/BarSection.qml b/modules/BarSection.qml index 39753ed..292ba69 100644 --- a/modules/BarSection.qml +++ b/modules/BarSection.qml @@ -8,6 +8,8 @@ Row { property string tooltip: "" property bool _hovered: false + Behavior on opacity { NumberAnimation { duration: 150 } } + layer.enabled: _hovered layer.effect: MultiEffect { shadowEnabled: true diff --git a/modules/Battery.qml b/modules/Battery.qml index bcde3ff..2b450b1 100644 --- a/modules/Battery.qml +++ b/modules/Battery.qml @@ -6,7 +6,8 @@ import "." as M M.BarSection { id: root spacing: M.Theme.moduleSpacing - visible: M.Modules.battery && (UPower.displayDevice?.isLaptopBattery ?? false) + opacity: M.Modules.battery && (UPower.displayDevice?.isLaptopBattery ?? false) ? 1 : 0 + visible: opacity > 0 tooltip: { const state = root.charging ? "Charging" : "Discharging"; const t = root.charging ? root.dev?.timeToFull : root.dev?.timeToEmpty; diff --git a/modules/Bluetooth.qml b/modules/Bluetooth.qml index a257292..a90fc62 100644 --- a/modules/Bluetooth.qml +++ b/modules/Bluetooth.qml @@ -5,7 +5,8 @@ import "." as M M.BarSection { id: root spacing: M.Theme.moduleSpacing - visible: M.Modules.bluetooth && root.state !== "unavailable" + opacity: M.Modules.bluetooth && root.state !== "unavailable" ? 1 : 0 + visible: opacity > 0 tooltip: { if (root.state === "off") return "Bluetooth: off"; diff --git a/modules/Mpris.qml b/modules/Mpris.qml index 333f312..6f4628f 100644 --- a/modules/Mpris.qml +++ b/modules/Mpris.qml @@ -5,7 +5,8 @@ import "." as M M.BarSection { id: root spacing: M.Theme.moduleSpacing - visible: M.Modules.mpris && player !== null + opacity: M.Modules.mpris && player !== null ? 1 : 0 + visible: opacity > 0 tooltip: { const p = root.player; if (!p) diff --git a/modules/Tray.qml b/modules/Tray.qml index c57a467..bbedb19 100644 --- a/modules/Tray.qml +++ b/modules/Tray.qml @@ -34,10 +34,8 @@ RowLayout { onRunningChanged: if (!running) iconItem._pulseOpacity = 1 } - M.ThemedIcon { + Item { anchors.fill: parent - source: iconItem.modelData.icon - tint: iconItem._needsAttention ? M.Theme.base08 : M.Theme.base0D opacity: iconItem._pulseOpacity layer.enabled: iconItem._needsAttention @@ -48,6 +46,12 @@ RowLayout { shadowVerticalOffset: 0 shadowHorizontalOffset: 0 } + + M.ThemedIcon { + anchors.fill: parent + source: iconItem.modelData.icon + tint: iconItem._needsAttention ? M.Theme.base08 : M.Theme.base0D + } } HoverHandler {