pragma ComponentBehavior: Bound import QtQuick import Quickshell import "../services" import "../compat/noctalia/Host" as NoctaliaHost // Not referenced by name: importing the directory makes Quickshell index the // Noctalia compatibility modules (see the Loader below). // qmllint disable unused-imports import "../compat/noctalia" as NoctaliaCompat // qmllint enable unused-imports // Loads enabled plugins that are not bar widgets: services stay loaded while // enabled; panels, overlays and menus load when summoned (or always, with // "keepLoaded") and receive open(payload), like in Omarchy. Bar widgets are // hosted by bar/modules/PluginModule.qml. Scope { id: root // The directory import above puts the Noctalia compatibility modules in // Quickshell's qs.* index; loading them by URL keeps any failure there a // warning instead of breaking the whole shell. Loader { active: PluginService.plugins.some(p => p.ecosystem === "noctalia" && PluginService.isEnabled(p.id)) source: active ? Qt.resolvedUrl("../compat/noctalia/Modules.qml") : "" } readonly property var hosted: PluginService.plugins.filter(p => PluginService.isEnabled(p.id)).map(p => p.id) Instantiator { model: root.hosted delegate: Scope { id: slot required property string modelData readonly property string pluginId: modelData readonly property var kinds: PluginService.kinds(pluginId) readonly property var manifest: (PluginService.plugin(pluginId) || {}).manifest || {} readonly property bool noctalia: PluginService.ecosystem(pluginId) === "noctalia" Loader { id: serviceLoader active: slot.kinds.includes("service") // Noctalia's Main.qml gets its pluginApi at creation. onActiveChanged: { if (!active) { const next = Object.assign({}, PluginService.services); delete next[slot.pluginId]; PluginService.services = next; } else if (slot.noctalia) { setSource(PluginService.entryUrl(slot.pluginId, "service"), { pluginApi: PluginService.noctaliaApi(slot.pluginId) }); } else { source = PluginService.entryUrl(slot.pluginId, "service"); } } Component.onCompleted: if (active) activeChanged() onLoaded: { if (slot.noctalia) { // Noctalia Main.qml: shared state reached via pluginApi.mainInstance. const napi = PluginService.noctaliaApi(slot.pluginId); if (napi) napi.mainInstance = item; } else { if ("shell" in item) item.shell = PluginService.shellFor(slot.pluginId); if ("pluginId" in item) item.pluginId = slot.pluginId; } const next = Object.assign({}, PluginService.services); next[slot.pluginId] = item; PluginService.services = next; } } // First matching surface kind (panel, overlay or menu). readonly property string surfaceKind: ["panel", "overlay", "menu"].find(k => kinds.includes(k)) || "" Loader { id: surfaceLoader active: !slot.noctalia && slot.surfaceKind !== "" && (slot.manifest.keepLoaded === true || PluginService.openSurfaces[slot.pluginId] === true) source: active ? PluginService.entryUrl(slot.pluginId, slot.surfaceKind) : "" onLoaded: { if ("shell" in item) item.shell = PluginService.shellFor(slot.pluginId); if ("pluginId" in item) item.pluginId = slot.pluginId; PluginService.registerSurface(slot.pluginId, item); } } // Noctalia panels: a glassMxrph bar drawer driven by pluginApi.openPanel(). Loader { active: slot.noctalia && slot.kinds.includes("panel") sourceComponent: NoctaliaHost.PanelHost { api: PluginService.noctaliaApi(slot.pluginId) source: PluginService.entryUrl(slot.pluginId, "panel") } } Component.onDestruction: PluginService.registerSurface(slot.pluginId, null) } } }