mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
mediaplayer-panel: properly fetch bar widget settings
This commit is contained in:
@@ -16,22 +16,28 @@ SmartPanel {
|
||||
preferredWidth: Math.round((root.isSideBySide ? 480 : 400) * Style.uiScaleRatio)
|
||||
preferredHeight: Math.round((root.compactMode ? 240 : (root.showAlbumArt ? 560 : 300)) * Style.uiScaleRatio)
|
||||
|
||||
readonly property var mediaMiniSettings: {
|
||||
try {
|
||||
var widgets = Settings.data.bar.widgets;
|
||||
var sections = ["left", "center", "right"];
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
var list = widgets[sections[i]];
|
||||
if (list) {
|
||||
for (var j = 0; j < list.length; j++) {
|
||||
if (list[j].id === "MediaMini") {
|
||||
return list[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return {};
|
||||
property var mediaMiniSettings: {
|
||||
const widget = BarService.lookupWidget("MediaMini", screen?.name);
|
||||
return widget ? widget.widgetSettings : null;
|
||||
}
|
||||
|
||||
function refreshMediaMiniSettings() {
|
||||
const widget = BarService.lookupWidget("MediaMini", screen?.name);
|
||||
root.mediaMiniSettings = widget ? widget.widgetSettings : null;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: BarService
|
||||
function onActiveWidgetsChanged() {
|
||||
root.refreshMediaMiniSettings();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Settings
|
||||
function onSettingsSaved() {
|
||||
root.refreshMediaMiniSettings();
|
||||
}
|
||||
}
|
||||
|
||||
readonly property string visualizerType: (mediaMiniSettings && mediaMiniSettings.visualizerType !== undefined) ? mediaMiniSettings.visualizerType : "linear"
|
||||
|
||||
Reference in New Issue
Block a user