feat(spectrum): slightly better initialization of the number of bands until noctalia-qs is updated everywhere.

This commit is contained in:
Lemmy
2026-03-21 21:44:09 -04:00
parent 6b30925fb4
commit 25d2efe9b3
+6 -9
View File
@@ -10,7 +10,9 @@ Singleton {
id: root
// TODO Remove in may 2026
property bool _initialized: false
Component.onCompleted: {
_setBandsCount();
}
// Register a component that needs audio data, call this when a visualizer becomes active.
// Pass a unique identifier (e.g., "lockscreen", "controlcenter:screen1", "plugin:fancy-audiovisualizer")
@@ -18,12 +20,6 @@ Singleton {
root._registeredComponents[componentId] = true;
root._registeredComponents = Object.assign({}, root._registeredComponents);
Logger.d("Spectrum", "Component registered:", componentId, "- total:", root.registeredCount);
// TODO Remove in may 2026
if (!_initialized) {
_initialized = true;
_setBandsCount();
}
}
// Unregister a component when it no longer needs audio data.
@@ -75,10 +71,11 @@ Singleton {
}
}
function _setBandsCount() {
const bandCount = Settings.data.audio.spectrumMirrored ? 32 : 64;
if (spectrum.bandCount !== undefined) {
spectrum.bandCount = Settings.data.audio.spectrumMirrored ? 32 : 64;
spectrum.bandCount = bandCount;
} else if (spectrum.barCount !== undefined) {
spectrum.barCount = Settings.data.audio.spectrumMirrored ? 32 : 64;
spectrum.barCount = bandCount;
}
}
}