diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 149458c9..f2592348 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -140,7 +140,6 @@ Singleton { property real marginVertical: 0.25 property real marginHorizontal: 0.25 - // Widget configuration for modular bar system property JsonObject widgets widgets: JsonObject { diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index 24c05980..e24da899 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -42,26 +42,27 @@ Rectangle { function wildCardMatch(str, rule) { if (!str || !rule) { - return false; + return false } - Logger.log("Tray", "wildCardMatch - Input str:", str, "rule:", rule); + Logger.log("Tray", "wildCardMatch - Input str:", str, "rule:", rule) // Escape all special regex characters in the rule - let escapedRule = rule.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + let escapedRule = rule.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // Convert '*' to '.*' for wildcard matching - let pattern = escapedRule.replace(/\\\*/g, '.*'); + let pattern = escapedRule.replace(/\\\*/g, '.*') // Add ^ and $ to match the entire string - pattern = '^' + pattern + '$'; + pattern = '^' + pattern + '$' - Logger.log("Tray", "wildCardMatch - Generated pattern:", pattern); + Logger.log("Tray", "wildCardMatch - Generated pattern:", pattern) try { - const regex = new RegExp(pattern, 'i'); // 'i' for case-insensitive - Logger.log("Tray", "wildCardMatch - Regex test result:", regex.test(str)); - return regex.test(str); + const regex = new RegExp(pattern, 'i') + // 'i' for case-insensitive + Logger.log("Tray", "wildCardMatch - Regex test result:", regex.test(str)) + return regex.test(str) } catch (e) { - Logger.warn("Tray", "Invalid regex pattern for wildcard match:", rule, e.message); - return false; // If regex is invalid, it won't match + Logger.warn("Tray", "Invalid regex pattern for wildcard match:", rule, e.message) + return false // If regex is invalid, it won't match } } diff --git a/Modules/Settings/Bar/WidgetSettings/TraySettings.qml b/Modules/Settings/Bar/WidgetSettings/TraySettings.qml index 77f00d5d..25d08bce 100644 --- a/Modules/Settings/Bar/WidgetSettings/TraySettings.qml +++ b/Modules/Settings/Bar/WidgetSettings/TraySettings.qml @@ -19,7 +19,9 @@ ColumnLayout { Component.onCompleted: { // Populate the ListModel from localBlacklist for (var i = 0; i < localBlacklist.length; i++) { - blacklistModel.append({"rule": localBlacklist[i]}) + blacklistModel.append({ + "rule": localBlacklist[i] + }) } } @@ -59,7 +61,9 @@ ColumnLayout { } } if (!exists) { - blacklistModel.append({"rule": newRule}) + blacklistModel.append({ + "rule": newRule + }) newRuleInput.text = "" } } @@ -77,47 +81,47 @@ ColumnLayout { clip: true model: blacklistModel delegate: Item { - width: ListView.width - height: 40 * scaling + width: ListView.width + height: 40 * scaling - Rectangle { - id: itemBackground - anchors.fill: parent - anchors.margins: Style.marginXS * scaling - color: Color.transparent // Make background transparent - border.color: Color.mOutline - border.width: Math.max(1, Style.borderS * scaling) - radius: Style.radiusS * scaling - visible: model.rule !== undefined && model.rule !== "" // Only visible if rule exists + Rectangle { + id: itemBackground + anchors.fill: parent + anchors.margins: Style.marginXS * scaling + color: Color.transparent // Make background transparent + border.color: Color.mOutline + border.width: Math.max(1, Style.borderS * scaling) + radius: Style.radiusS * scaling + visible: model.rule !== undefined && model.rule !== "" // Only visible if rule exists + } + + Row { + anchors.fill: parent + anchors.leftMargin: Style.marginS * scaling + anchors.rightMargin: Style.marginS * scaling + spacing: Style.marginS * scaling + + NText { + text: model.rule + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true } - Row { - anchors.fill: parent - anchors.leftMargin: Style.marginS * scaling - anchors.rightMargin: Style.marginS * scaling - spacing: Style.marginS * scaling - - NText { - text: model.rule - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - Layout.fillWidth: true - } - - NIconButton { - width: 16 * scaling - height: 16 * scaling - icon: "close" - baseSize: 8 * scaling - colorBg: Color.mSurfaceVariant - colorFg: Color.mOnSurface - colorBgHover: Color.mError - colorFgHover: Color.mOnError - onClicked: { - blacklistModel.remove(index) - } - } + NIconButton { + width: 16 * scaling + height: 16 * scaling + icon: "close" + baseSize: 8 * scaling + colorBg: Color.mSurfaceVariant + colorFg: Color.mOnSurface + colorBgHover: Color.mError + colorFgHover: Color.mOnError + onClicked: { + blacklistModel.remove(index) + } } + } } }