From 65adecfa210642b9718f6c21fc77157393871b51 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Sat, 28 Feb 2026 00:23:29 +0100 Subject: [PATCH] ddcutil-service usage --- Components/MarqueeText.qml | 31 ++++++++++++++++--------------- Modules/MediaWidget.qml | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Components/MarqueeText.qml b/Components/MarqueeText.qml index 3788844..925b409 100644 --- a/Components/MarqueeText.qml +++ b/Components/MarqueeText.qml @@ -4,6 +4,7 @@ import qs.Config Item { id: root + property alias anim: marqueeAnim property bool animate: false property color color: DynamicColors.palette.m3onSurface property int fadeStrengthAnimMs: 180 @@ -29,13 +30,11 @@ Item { } function resetMarquee() { - // stop + reset all state immediately marqueeAnim.stop(); strip.x = 0; root.sliding = false; root.leftFadeEnabled = false; - // restart after bindings/layout settle if (root.marqueeEnabled && root.overflowing && root.visible) { marqueeAnim.restart(); } @@ -120,20 +119,9 @@ Item { SequentialAnimation { id: marqueeAnim - loops: Animation.Infinite - running: root.marqueeEnabled && root.overflowing && root.visible + running: false - ScriptAction { - script: { - strip.x = 0; - root.sliding = false; - root.leftFadeEnabled = false; - } - } - - PauseAnimation { - duration: root.pauseMs - } + onFinished: pauseTimer.restart() ScriptAction { script: { @@ -175,6 +163,19 @@ Item { } } } + + Timer { + id: pauseTimer + + interval: root.pauseMs + repeat: false + running: true + + onTriggered: { + if (root.marqueeEnabled) + marqueeAnim.start(); + } + } } Rectangle { diff --git a/Modules/MediaWidget.qml b/Modules/MediaWidget.qml index 73b4056..8b47a07 100644 --- a/Modules/MediaWidget.qml +++ b/Modules/MediaWidget.qml @@ -65,9 +65,24 @@ Item { color: Players.active?.isPlaying ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface font.pointSize: Appearance.font.size.normal horizontalAlignment: Text.AlignHCenter + marqueeEnabled: false pauseMs: 4000 text: root.currentMedia width: root.textWidth + + CustomMouseArea { + anchors.fill: parent + hoverEnabled: true + + onContainsMouseChanged: { + if (!containsMouse) { + mediatext.marqueeEnabled = false; + } else { + mediatext.marqueeEnabled = true; + mediatext.anim.start(); + } + } + } } } }