mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
SessionMenu: add LockScreen import
LockScreen: add missing imports N*Spectrum: add null checks
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -32,7 +32,7 @@ Item {
|
||||
var ctx = getContext("2d")
|
||||
ctx.reset()
|
||||
|
||||
if (values.length === 0) {
|
||||
if (!values || !Array.isArray(values) || values.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user