diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-05 16:52:33 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-05 16:52:33 +1000 |
| commit | b8a22eaa28f5ce936d17d38043c9cf00fdf95b07 (patch) | |
| tree | 43d49f9fb4e6a4620b5c980c63b1b10f5639be7c /modules/dashboard | |
| parent | dashboard: media player selector elide text (diff) | |
| download | caelestia-shell-b8a22eaa28f5ce936d17d38043c9cf00fdf95b07.tar.gz caelestia-shell-b8a22eaa28f5ce936d17d38043c9cf00fdf95b07.tar.bz2 caelestia-shell-b8a22eaa28f5ce936d17d38043c9cf00fdf95b07.zip | |
dashboard: dont update pane if not current
Diffstat (limited to 'modules/dashboard')
| -rw-r--r-- | modules/dashboard/Content.qml | 12 | ||||
| -rw-r--r-- | modules/dashboard/Dash.qml | 4 | ||||
| -rw-r--r-- | modules/dashboard/Media.qml | 8 | ||||
| -rw-r--r-- | modules/dashboard/dash/Media.qml | 6 | ||||
| -rw-r--r-- | modules/dashboard/dash/User.qml | 1 | ||||
| -rw-r--r-- | modules/dashboard/dash/Weather.qml | 1 |
6 files changed, 23 insertions, 9 deletions
diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml index 5b88f9b..bd613e7 100644 --- a/modules/dashboard/Content.qml +++ b/modules/dashboard/Content.qml @@ -51,17 +51,25 @@ Item { currentIndex: tabs.currentIndex ClippingWrapperRectangle { + id: dash + radius: Appearance.rounding.normal color: "transparent" - Dash {} + Dash { + shouldUpdate: visible && dash.ListView.isCurrentItem + } } ClippingWrapperRectangle { + id: media + radius: Appearance.rounding.normal color: "transparent" - Media {} + Media { + shouldUpdate: visible && media.ListView.isCurrentItem + } } ClippingWrapperRectangle { diff --git a/modules/dashboard/Dash.qml b/modules/dashboard/Dash.qml index d5f3e34..eaf4344 100644 --- a/modules/dashboard/Dash.qml +++ b/modules/dashboard/Dash.qml @@ -7,6 +7,8 @@ import QtQuick.Layouts GridLayout { id: root + required property bool shouldUpdate + rowSpacing: Appearance.spacing.normal columnSpacing: Appearance.spacing.normal @@ -72,6 +74,8 @@ GridLayout { Media { id: media + + shouldUpdate: root.shouldUpdate } } diff --git a/modules/dashboard/Media.qml b/modules/dashboard/Media.qml index 6d894af..9751572 100644 --- a/modules/dashboard/Media.qml +++ b/modules/dashboard/Media.qml @@ -14,6 +14,8 @@ import QtQuick.Effects Item { id: root + required property bool shouldUpdate + property real playerProgress: { const active = Players.active; return active?.length ? active.position / active.length : 0; @@ -39,7 +41,7 @@ Item { } Timer { - running: root.visible && (Players.active?.isPlaying ?? false) + running: root.shouldUpdate && (Players.active?.isPlaying ?? false) interval: DashboardConfig.mediaUpdateInterval triggeredOnStart: true repeat: true @@ -52,7 +54,7 @@ Item { stdout: SplitParser { onRead: data => { root.cava = data.slice(0, -1).split(";").map(v => parseInt(v, 10)); - if (visualiser.visible) + if (root.shouldUpdate) visualiser.requestPaint(); } } @@ -535,7 +537,7 @@ Item { anchors.left: details.right anchors.leftMargin: Appearance.spacing.large - playing: visible && (Players.active?.isPlaying ?? false) + playing: root.shouldUpdate && (Players.active?.isPlaying ?? false) speed: BeatDetector.bpm / 300 source: "root:/assets/bongocat.gif" asynchronous: true diff --git a/modules/dashboard/dash/Media.qml b/modules/dashboard/dash/Media.qml index ec72d03..7122d69 100644 --- a/modules/dashboard/dash/Media.qml +++ b/modules/dashboard/dash/Media.qml @@ -10,6 +10,8 @@ import QtQuick.Shapes Item { id: root + required property bool shouldUpdate + property real playerProgress: { const active = Players.active; return active?.length ? active.position / active.length : 0; @@ -28,7 +30,7 @@ Item { } Timer { - running: root.visible && (Players.active?.isPlaying ?? false) + running: root.shouldUpdate && (Players.active?.isPlaying ?? false) interval: DashboardConfig.mediaUpdateInterval triggeredOnStart: true repeat: true @@ -218,7 +220,7 @@ Item { anchors.bottomMargin: Appearance.padding.large anchors.margins: Appearance.padding.large * 2 - playing: visible && (Players.active?.isPlaying ?? false) + playing: root.shouldUpdate && (Players.active?.isPlaying ?? false) speed: BeatDetector.bpm / 300 source: "root:/assets/bongocat.gif" asynchronous: true diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index 46055e9..c7d2bfd 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -4,7 +4,6 @@ import "root:/config" import "root:/utils" import Quickshell import Quickshell.Io -import Quickshell.Widgets import QtQuick Row { diff --git a/modules/dashboard/dash/Weather.qml b/modules/dashboard/dash/Weather.qml index 489444f..468d542 100644 --- a/modules/dashboard/dash/Weather.qml +++ b/modules/dashboard/dash/Weather.qml @@ -2,7 +2,6 @@ import "root:/widgets" import "root:/services" import "root:/config" import "root:/utils" -import Quickshell.Io import QtQuick Item { |