Remove unreleased Noctalia shell compatibility

This commit is contained in:
Ryan Hughes
2026-05-17 12:06:18 -04:00
parent 7517c8b624
commit 5faee9cf76
42 changed files with 14 additions and 1979 deletions
@@ -26,11 +26,8 @@ Item {
// the bar just renders whatever it's handed. The bar font follows the
// OS-level fontconfig monospace binding — it is not stored in shell.json.
required property var barConfig
// Injected by the host shell so the bar can detect Noctalia-compat plugins
// and look up manifests when wiring per-widget Noctalia pluginApi.
property var pluginRegistry: null
// Injected by the host shell. Used so Noctalia plugins that reach for
// shell-wide APIs (openPanel, currentScreen) can do so via pluginApi.
// Injected by the host shell. Used for shell-wide actions such as opening
// settings and persisting inline widget state.
property var shell: null
// Mirrors the on-disk `bar-off` flag so the user can hide the bar without
// killing the entire shell. Wired to BarPanel.visible below; updated by the
@@ -93,40 +90,6 @@ Item {
if (activePopout === owner) activePopout = null
}
// -------------------------------------------------- Noctalia compat helpers
//
// The shell owns pluginApi creation and Main.qml service instantiation now;
// bar widgets just look up their api by moduleName. Keeping section/index
// helpers here because they're needed for Noctalia bar-widget injection
// (widgetId, section, sectionWidgetIndex, sectionWidgetsCount).
function sectionOfEntry(entry) {
var sections = ["left", "center", "right"]
for (var s = 0; s < sections.length; s++) {
var list = layoutConfig[sections[s]] || []
for (var i = 0; i < list.length; i++) {
if (list[i] === entry) return sections[s]
}
}
return ""
}
function indexOfEntry(entry) {
var section = sectionOfEntry(entry)
var list = section ? (layoutConfig[section] || []) : []
for (var i = 0; i < list.length; i++) if (list[i] === entry) return i
return -1
}
function entriesOfSection(section) {
return Array.isArray(layoutConfig[section]) ? layoutConfig[section] : []
}
function noctaliaPluginApiFor(moduleName) {
if (!shell || typeof shell.noctaliaPluginApiFor !== "function") return null
return shell.noctaliaPluginApiFor(moduleName)
}
readonly property bool vertical: position === "left" || position === "right"
readonly property int barSize: vertical ? 28 : 26
@@ -1269,20 +1232,6 @@ Item {
if ("bar" in target) target.bar = root
if ("moduleName" in target) target.moduleName = moduleName
if ("settings" in target) target.settings = moduleSettings
// Noctalia compat injection. Only kicks in for plugins whose manifest
// was translated from Noctalia shape; for our first-party widgets these
// properties don't exist on the target item so nothing happens.
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[moduleName] : null
if (manifest && manifest.__noctaliaCompat) {
if ("pluginApi" in target) target.pluginApi = root.noctaliaPluginApiFor(moduleName)
if ("widgetId" in target) target.widgetId = moduleName
if ("section" in target) target.section = root.sectionOfEntry(entry)
if ("sectionWidgetIndex" in target) target.sectionWidgetIndex = root.indexOfEntry(entry)
if ("sectionWidgetsCount" in target) target.sectionWidgetsCount = root.entriesOfSection(root.sectionOfEntry(entry)).length
if ("screen" in target && root.QsWindow && root.QsWindow.window)
target.screen = root.QsWindow.window.screen
}
}
Component {
@@ -370,7 +370,7 @@ Item {
displayName: meta.displayName || manifest.name || key,
name: meta.displayName || manifest.name || key,
description: meta.description || manifest.description || "",
category: meta.category || (manifest.__noctaliaCompat ? "Noctalia" : "Plugin"),
category: meta.category || "Plugin",
allowMultiple: meta.allowMultiple === true,
settingsForm: meta.settingsForm || "",
schema: Array.isArray(meta.schema) ? meta.schema : [],
@@ -402,17 +402,9 @@ Item {
var meta = widgetMetadata(id)
if (meta.settingsForm) return true
if (widgetSchema(id).length > 0) return true
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[id] : null
if (manifest && manifest.__noctaliaCompat && manifest.entryPoints && manifest.entryPoints.settings)
return true
return false
}
function widgetIsNoctaliaPlugin(id) {
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[id] : null
return !!(manifest && manifest.__noctaliaCompat)
}
function widgetAllowsMultiple(id) {
var meta = widgetMetadata(id)
if (meta.allowMultiple === true) return true
@@ -465,8 +457,7 @@ Item {
var allowsMultiple = widgetAllowsMultiple(id)
if (!allowsMultiple && existingInBar[id]) continue
result.push({ id: id, name: widgetName(id), description: widgetDescription(id),
elsewhere: allowsMultiple && !!existingInBar[id] && !existsHere,
isNoctalia: widgetIsNoctaliaPlugin(id) })
elsewhere: allowsMultiple && !!existingInBar[id] && !existsHere })
}
return result
}
@@ -986,7 +977,6 @@ Item {
Text {
text: modelData.name
+ (modelData.isNoctalia ? " (Noctalia)" : "")
+ (modelData.elsewhere ? " (elsewhere)" : "")
color: root.foreground
font.family: root.fontFamily
@@ -1246,9 +1236,6 @@ Item {
case "weatherSettings": return weatherSettingsComponent
}
}
var manifest = root.pluginRegistry ? root.pluginRegistry.installedPlugins[id] : null
if (manifest && manifest.__noctaliaCompat && manifest.entryPoints && manifest.entryPoints.settings)
return noctaliaSettingsComponent
if (widgetSchema(id).length > 0) return dynamicSettingsComponent
return null
}
@@ -1262,53 +1249,6 @@ Item {
}
}
Component {
id: noctaliaSettingsComponent
Item {
id: noctaliaForm
property var entry: ({})
property string pluginId: entry && entry.id ? String(entry.id) : ""
property var manifest: pluginId && root.pluginRegistry
? root.pluginRegistry.installedPlugins[pluginId] : null
function saveSettings() {
if (settingsLoader.item && typeof settingsLoader.item.saveSettings === "function") {
settingsLoader.item.saveSettings()
} else {
console.warn("Noctalia settings form has no saveSettings():", pluginId)
}
}
implicitHeight: settingsLoader.item ? settingsLoader.item.implicitHeight : 0
implicitWidth: settingsLoader.item ? settingsLoader.item.implicitWidth : 0
Loader {
id: settingsLoader
anchors.fill: parent
source: {
if (!noctaliaForm.manifest) return ""
return root.pluginRegistry.entryPointUrl(noctaliaForm.manifest, "settings")
}
asynchronous: false
onLoaded: {
if (!item) return
var api = (root.shell && typeof root.shell.noctaliaPluginApiFor === "function")
? root.shell.noctaliaPluginApiFor(noctaliaForm.pluginId) : null
if (api && "pluginApi" in item) item.pluginApi = api
if ("screen" in item && root.QsWindow && root.QsWindow.window)
item.screen = root.QsWindow.window.screen
}
onStatusChanged: {
if (status === Loader.Error) {
console.warn("noctalia Settings.qml failed for " + noctaliaForm.pluginId + ":",
sourceComponent ? sourceComponent.errorString() : "")
}
}
}
}
}
Component {
id: spacerSettingsComponent