SessionMenu: add LockScreen import

LockScreen: add missing imports
N*Spectrum: add null checks
This commit is contained in:
Ly-sec
2025-11-09 09:46:45 +01:00
parent fb59883479
commit 871104be59
5 changed files with 10 additions and 5 deletions
+4
View File
@@ -9,6 +9,10 @@ import Quickshell.Services.UPower
import Quickshell.Io
import Quickshell.Widgets
import qs.Commons
import qs.Services.Hardware
import qs.Services.Location
import qs.Services.Media
import qs.Services.UI
import qs.Widgets
import qs.Widgets.AudioSpectrum
@@ -8,6 +8,7 @@ import Quickshell.Widgets
import Quickshell.Wayland
import qs.Commons
import qs.Services.Compositor
import qs.Services.UI
import qs.Widgets
import qs.Modules.MainScreen
+2 -2
View File
@@ -14,7 +14,7 @@ Item {
property real minimumSignalValue: 0.05 // Default to 5% of height
// Pre compute horizontal mirroring
readonly property int valuesCount: values.length
readonly property int valuesCount: (values && Array.isArray(values)) ? values.length : 0
readonly property int totalBars: valuesCount * 2
readonly property real barSlotSize: totalBars > 0 ? (vertical ? height : width) / totalBars : 0
@@ -27,7 +27,7 @@ Item {
property int valueIndex: index < root.valuesCount ? root.valuesCount - 1 - index // Mirrored half
: index - root.valuesCount // Normal half
property real rawAmp: root.values[valueIndex]
property real rawAmp: (root.values && root.values[valueIndex] !== undefined) ? root.values[valueIndex] : 0
property real amp: (root.showMinimumSignal && rawAmp === 0) ? root.minimumSignalValue : rawAmp
color: root.fillColor
+2 -2
View File
@@ -14,7 +14,7 @@ Item {
property real minimumSignalValue: 0.05 // Default to 5% of height
// Pre-compute mirroring
readonly property int valuesCount: values.length
readonly property int valuesCount: (values && Array.isArray(values)) ? values.length : 0
readonly property int totalBars: valuesCount * 2
readonly property real barSlotSize: totalBars > 0 ? (vertical ? height : width) / totalBars : 0
@@ -30,7 +30,7 @@ Item {
property int valueIndex: index < root.valuesCount ? root.valuesCount - 1 - index // Mirrored half
: index - root.valuesCount // Normal half
property real rawAmp: root.values[valueIndex]
property real rawAmp: (root.values && root.values[valueIndex] !== undefined) ? root.values[valueIndex] : 0
property real amp: (root.showMinimumSignal && rawAmp === 0) ? root.minimumSignalValue : rawAmp
property real barSize: (vertical ? root.width : root.height) * amp
+1 -1
View File
@@ -32,7 +32,7 @@ Item {
var ctx = getContext("2d")
ctx.reset()
if (values.length === 0) {
if (!values || !Array.isArray(values) || values.length === 0) {
return
}