From b5be14661936f976eebe5ac5e21cbb82fbf1056c Mon Sep 17 00:00:00 2001 From: Damocles Date: Fri, 24 Apr 2026 09:04:09 +0200 Subject: [PATCH] extract PulseAnimation component from 3 modules --- shell/modules/BatteryModule.qml | 20 ++------------------ shell/modules/PrivacyModule.qml | 28 ++++------------------------ shell/modules/PulseAnimation.qml | 20 ++++++++++++++++++++ shell/modules/TrayModule.qml | 20 ++------------------ shell/modules/qmldir | 1 + 5 files changed, 29 insertions(+), 60 deletions(-) create mode 100644 shell/modules/PulseAnimation.qml diff --git a/shell/modules/BatteryModule.qml b/shell/modules/BatteryModule.qml index 9050f3e..3d0bf08 100644 --- a/shell/modules/BatteryModule.qml +++ b/shell/modules/BatteryModule.qml @@ -13,25 +13,9 @@ M.PinnableSection { property real _blinkOpacity: 1 - SequentialAnimation { + M.PulseAnimation on _blinkOpacity { running: S.BatteryService.critical - loops: Animation.Infinite - NumberAnimation { - target: root - property: "_blinkOpacity" - to: 0.45 - duration: 400 - easing.type: Easing.InOutQuad - } - NumberAnimation { - target: root - property: "_blinkOpacity" - to: 1 - duration: 400 - easing.type: Easing.InOutQuad - } - onRunningChanged: if (!running) - root._blinkOpacity = 1 + minOpacity: 0.45 } // Bar widgets diff --git a/shell/modules/PrivacyModule.qml b/shell/modules/PrivacyModule.qml index 1f7b29d..3f8b84f 100644 --- a/shell/modules/PrivacyModule.qml +++ b/shell/modules/PrivacyModule.qml @@ -55,19 +55,9 @@ Row { shadowHorizontalOffset: 0 } - SequentialAnimation on opacity { + M.PulseAnimation on opacity { running: root._videoCapture - loops: Animation.Infinite - NumberAnimation { - to: 0.4 - duration: 600 - easing.type: Easing.InOutQuad - } - NumberAnimation { - to: 1 - duration: 600 - easing.type: Easing.InOutQuad - } + halfDuration: 600 } } @@ -89,19 +79,9 @@ Row { shadowHorizontalOffset: 0 } - SequentialAnimation on opacity { + M.PulseAnimation on opacity { running: root._audioIn - loops: Animation.Infinite - NumberAnimation { - to: 0.4 - duration: 600 - easing.type: Easing.InOutQuad - } - NumberAnimation { - to: 1 - duration: 600 - easing.type: Easing.InOutQuad - } + halfDuration: 600 } } } diff --git a/shell/modules/PulseAnimation.qml b/shell/modules/PulseAnimation.qml new file mode 100644 index 0000000..a0270e8 --- /dev/null +++ b/shell/modules/PulseAnimation.qml @@ -0,0 +1,20 @@ +import QtQuick + +SequentialAnimation { + id: root + loops: Animation.Infinite + + property real minOpacity: 0.4 + property int halfDuration: 400 + + NumberAnimation { + to: root.minOpacity + duration: root.halfDuration + easing.type: Easing.InOutQuad + } + NumberAnimation { + to: 1 + duration: root.halfDuration + easing.type: Easing.InOutQuad + } +} diff --git a/shell/modules/TrayModule.qml b/shell/modules/TrayModule.qml index ee02708..2224c9f 100644 --- a/shell/modules/TrayModule.qml +++ b/shell/modules/TrayModule.qml @@ -29,25 +29,9 @@ RowLayout { implicitWidth: S.Theme.fontSize + 4 implicitHeight: S.Theme.fontSize + 4 - SequentialAnimation { + M.PulseAnimation on _pulseOpacity { running: iconItem._needsAttention - loops: Animation.Infinite - NumberAnimation { - target: iconItem - property: "_pulseOpacity" - to: 0.3 - duration: 400 - easing.type: Easing.InOutQuad - } - NumberAnimation { - target: iconItem - property: "_pulseOpacity" - to: 1 - duration: 400 - easing.type: Easing.InOutQuad - } - onRunningChanged: if (!running) - iconItem._pulseOpacity = 1 + minOpacity: 0.3 } Item { diff --git a/shell/modules/qmldir b/shell/modules/qmldir index a7934b5..13ce5bd 100644 --- a/shell/modules/qmldir +++ b/shell/modules/qmldir @@ -31,6 +31,7 @@ PowerModule 1.0 PowerModule.qml PowerProfileModule 1.0 PowerProfileModule.qml PrivacyModule 1.0 PrivacyModule.qml ProcessList 1.0 ProcessList.qml +PulseAnimation 1.0 PulseAnimation.qml ScreenCapture 1.0 ScreenCapture.qml ScreenCorners 1.0 ScreenCorners.qml TemperatureModule 1.0 TemperatureModule.qml