BarTab: better plugin display

This commit is contained in:
Ly-sec
2025-12-02 15:50:03 +01:00
parent 24a9e94baf
commit 65cc3c91d8
3 changed files with 46 additions and 3 deletions
+19 -2
View File
@@ -5,6 +5,7 @@ import Quickshell
import qs.Commons
import qs.Services.Compositor
import qs.Services.UI
import qs.Services.Noctalia
import qs.Widgets
ColumnLayout {
@@ -425,10 +426,26 @@ ColumnLayout {
availableWidgets.clear();
const widgets = BarWidgetRegistry.getAvailableWidgets();
widgets.forEach(entry => {
const isPlugin = BarWidgetRegistry.isPluginWidget(entry);
let displayName = entry;
// For plugin widgets, strip the "plugin:" prefix and try to get the actual plugin name
if (isPlugin) {
const pluginId = entry.replace("plugin:", "");
const manifest = PluginRegistry.getPluginManifest(pluginId);
if (manifest && manifest.name) {
displayName = manifest.name;
} else {
// Fallback: just strip the prefix
displayName = pluginId;
}
}
availableWidgets.append({
"key": entry,
"name": entry,
"badgeLocations": getWidgetLocations(entry)
"name": displayName,
"badgeLocations": getWidgetLocations(entry),
"isPlugin": isPlugin
});
});
}
+10
View File
@@ -222,6 +222,16 @@ RowLayout {
spacing: Style.marginS
Layout.alignment: Qt.AlignRight
// Plugin badge indicator
NIcon {
visible: typeof isPlugin !== 'undefined' && isPlugin === true
icon: "plugin"
pointSize: Style.fontSizeXS
color: highlighted ? Color.mOnHover : Color.mSecondary
Layout.preferredWidth: Style.baseWidgetSize * 0.7
Layout.preferredHeight: Style.baseWidgetSize * 0.7
}
Repeater {
model: typeof badgeLocations !== 'undefined' ? badgeLocations : []
+17 -1
View File
@@ -252,8 +252,24 @@ NBox {
anchors.centerIn: parent
spacing: Style.marginXXS
// Plugin indicator icon
NIcon {
visible: root.widgetRegistry && root.widgetRegistry.isPluginWidget(modelData.id)
icon: "plugin"
pointSize: Style.fontSizeXXS
color: root.getWidgetColor(modelData)[1]
Layout.preferredWidth: visible ? Style.baseWidgetSize * 0.5 : 0
Layout.preferredHeight: Style.baseWidgetSize * 0.5
}
NText {
text: modelData.id
text: {
// Strip "plugin:" prefix for display
if (root.widgetRegistry && root.widgetRegistry.isPluginWidget(modelData.id)) {
return modelData.id.replace("plugin:", "");
}
return modelData.id;
}
pointSize: Style.fontSizeXS
color: root.getWidgetColor(modelData)[1]
horizontalAlignment: Text.AlignHCenter