perf/feat: gate cpu behaviors on _showPanel; add reducedMotion theme setting for ambient animations

This commit is contained in:
Damocles 2026-04-15 19:03:56 +02:00
parent 937ae5af2e
commit c96b023fbe
4 changed files with 11 additions and 2 deletions

View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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;
}
}