mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(spectrum): slightly better initialization of the number of bands until noctalia-qs is updated everywhere.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user