ddcutil-service usage

This commit is contained in:
Zacharias-Brohn
2026-02-28 00:23:29 +01:00
parent 178375d861
commit 65adecfa21
2 changed files with 31 additions and 15 deletions
+16 -15
View File
@@ -4,6 +4,7 @@ import qs.Config
Item { Item {
id: root id: root
property alias anim: marqueeAnim
property bool animate: false property bool animate: false
property color color: DynamicColors.palette.m3onSurface property color color: DynamicColors.palette.m3onSurface
property int fadeStrengthAnimMs: 180 property int fadeStrengthAnimMs: 180
@@ -29,13 +30,11 @@ Item {
} }
function resetMarquee() { function resetMarquee() {
// stop + reset all state immediately
marqueeAnim.stop(); marqueeAnim.stop();
strip.x = 0; strip.x = 0;
root.sliding = false; root.sliding = false;
root.leftFadeEnabled = false; root.leftFadeEnabled = false;
// restart after bindings/layout settle
if (root.marqueeEnabled && root.overflowing && root.visible) { if (root.marqueeEnabled && root.overflowing && root.visible) {
marqueeAnim.restart(); marqueeAnim.restart();
} }
@@ -120,20 +119,9 @@ Item {
SequentialAnimation { SequentialAnimation {
id: marqueeAnim id: marqueeAnim
loops: Animation.Infinite running: false
running: root.marqueeEnabled && root.overflowing && root.visible
ScriptAction { onFinished: pauseTimer.restart()
script: {
strip.x = 0;
root.sliding = false;
root.leftFadeEnabled = false;
}
}
PauseAnimation {
duration: root.pauseMs
}
ScriptAction { ScriptAction {
script: { script: {
@@ -175,6 +163,19 @@ Item {
} }
} }
} }
Timer {
id: pauseTimer
interval: root.pauseMs
repeat: false
running: true
onTriggered: {
if (root.marqueeEnabled)
marqueeAnim.start();
}
}
} }
Rectangle { Rectangle {
+15
View File
@@ -65,9 +65,24 @@ Item {
color: Players.active?.isPlaying ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface color: Players.active?.isPlaying ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
marqueeEnabled: false
pauseMs: 4000 pauseMs: 4000
text: root.currentMedia text: root.currentMedia
width: root.textWidth width: root.textWidth
CustomMouseArea {
anchors.fill: parent
hoverEnabled: true
onContainsMouseChanged: {
if (!containsMouse) {
mediatext.marqueeEnabled = false;
} else {
mediatext.marqueeEnabled = true;
mediatext.anim.start();
}
}
}
} }
} }
} }