feat: Add custom settings and blacklist for Tray module

This commit is contained in:
loner
2025-10-10 03:34:09 +08:00
parent b30879b38d
commit 2f2bcdebc8
3 changed files with 21 additions and 8 deletions
+18 -1
View File
@@ -16,11 +16,28 @@ Rectangle {
property ShellScreen screen
property real scaling: 1.0
// Widget properties passed from Bar.qml for per-instance settings
property string widgetId: ""
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) {
return widgets[sectionWidgetIndex]
}
}
return {}
}
readonly property string barPosition: Settings.data.bar.position
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
readonly property bool compact: (Settings.data.bar.density === "compact")
property real itemSize: Math.round(Style.capsuleHeight * 0.65 * scaling)
property list<string> blacklist: Settings.data.bar.trayBlacklist || [] // Read from settings
property list<string> blacklist: widgetSettings.blacklist || Settings.data.bar.trayBlacklist || [] // Read from settings
property var filteredItems: []
function wildCardMatch(str, rule) {
@@ -110,12 +110,7 @@ Popup {
onClicked: {
if (settingsLoader.item && settingsLoader.item.saveSettings) {
var newSettings = settingsLoader.item.saveSettings()
if (widgetSettings.widgetId === "Tray") {
Settings.data.bar.trayBlacklist = newSettings.blacklist || []
Settings.saveImmediate()
} else {
root.updateWidgetSettings(sectionId, widgetSettings.widgetIndex, newSettings)
}
root.updateWidgetSettings(sectionId, widgetSettings.widgetIndex, newSettings)
widgetSettings.close()
}
}