mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
BarTab: better plugin display
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 : []
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user