From c96b023fbe1507abfdc4fa73b6e5145cfdd086ce Mon Sep 17 00:00:00 2001 From: Damocles Date: Wed, 15 Apr 2026 19:03:56 +0200 Subject: [PATCH] perf/feat: gate cpu behaviors on _showPanel; add reducedMotion theme setting for ambient animations --- modules/BackgroundOverlay.qml | 6 +++++- modules/Cpu.qml | 2 ++ modules/OverviewBackdrop.qml | 2 +- modules/Theme.qml | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/BackgroundOverlay.qml b/modules/BackgroundOverlay.qml index bd028b6..1936770 100644 --- a/modules/BackgroundOverlay.qml +++ b/modules/BackgroundOverlay.qml @@ -54,6 +54,7 @@ PanelWindow { text: ":" color: colon._colors[colon._colorIdx % colon._colors.length] Behavior on color { + enabled: !M.Theme.reducedMotion ColorAnimation { duration: 800 } @@ -110,6 +111,7 @@ PanelWindow { readonly property var _colors: [M.Theme.base08, M.Theme.base09, M.Theme.base0A, M.Theme.base0B, M.Theme.base0C, M.Theme.base0D, M.Theme.base0E, M.Theme.base05] color: _colors[_colorIdx % _colors.length] Behavior on color { + enabled: !M.Theme.reducedMotion ColorAnimation { duration: 800 } @@ -117,7 +119,7 @@ PanelWindow { SequentialAnimation { loops: Animation.Infinite - running: true + running: !M.Theme.reducedMotion NumberAnimation { target: colon property: "opacity" @@ -187,6 +189,7 @@ PanelWindow { height: parent.height color: colon._colors[colon._colorIdx % colon._colors.length] Behavior on color { + enabled: !M.Theme.reducedMotion ColorAnimation { duration: 800 } @@ -195,6 +198,7 @@ PanelWindow { opacity: 0.6 Behavior on width { + enabled: !M.Theme.reducedMotion NumberAnimation { duration: 300 } diff --git a/modules/Cpu.qml b/modules/Cpu.qml index e3fd9f8..c0d7274 100644 --- a/modules/Cpu.qml +++ b/modules/Cpu.qml @@ -8,6 +8,7 @@ M.BarSection { property int usage: M.SystemStats.cpuUsage Behavior on usage { + enabled: root._showPanel NumberAnimation { duration: 400 easing.type: Easing.OutCubic @@ -16,6 +17,7 @@ M.BarSection { property real freqGhz: M.SystemStats.cpuFreqGhz Behavior on freqGhz { + enabled: root._showPanel NumberAnimation { duration: 400 easing.type: Easing.OutCubic diff --git a/modules/OverviewBackdrop.qml b/modules/OverviewBackdrop.qml index c9652a6..ab17be2 100644 --- a/modules/OverviewBackdrop.qml +++ b/modules/OverviewBackdrop.qml @@ -48,7 +48,7 @@ PanelWindow { // Wave animation: 6s sweep + 8s pause, only while overview is open SequentialAnimation on uWavePhase { loops: Animation.Infinite - running: M.NiriIpc.overviewOpen + running: M.NiriIpc.overviewOpen && !M.Theme.reducedMotion NumberAnimation { from: -200 to: fx.width + 200 diff --git a/modules/Theme.qml b/modules/Theme.qml index f924df9..13ac23c 100644 --- a/modules/Theme.qml +++ b/modules/Theme.qml @@ -35,6 +35,7 @@ QtObject { property int groupSpacing: 6 property int radius: 4 property int screenRadius: 15 + property bool reducedMotion: false property FileView _themeFile: FileView { path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/theme.json" @@ -75,5 +76,7 @@ QtObject { root.radius = data.radius; if (data.screenRadius !== undefined) root.screenRadius = data.screenRadius; + if (data.reducedMotion !== undefined) + root.reducedMotion = data.reducedMotion; } }