diff --git i/Cat.qml w/Cat.qml index 58ed7f6..f1bbe9b 100644 --- i/Cat.qml +++ w/Cat.qml @@ -30,13 +30,18 @@ Item { property string omarchyPath: "" readonly property string pluginId: manifest && manifest.id ? String(manifest.id) : "io.github.tallsam.navbar-cat" + // The shell strips `__sourceDir` from third-party manifests, so fall back to + // this file's own directory. + readonly property string pluginDir: manifest && manifest.__sourceDir + ? String(manifest.__sourceDir) + : String(Qt.resolvedUrl(".")).replace(/^file:\/\//, "").replace(/\/$/, "") readonly property string assetDir: { - var dir = manifest && manifest.__sourceDir ? String(manifest.__sourceDir) : "" + var dir = pluginDir if (dir === "") return "" return (dir.indexOf("file://") === 0 ? dir : "file://" + dir) + "/assets" } readonly property string helper: { - var dir = manifest && manifest.__sourceDir ? String(manifest.__sourceDir) : "" + var dir = pluginDir if (dir === "") return "" return dir.replace(/^file:\/\//, "") + "/bin/navbar-cat-cursor" } @@ -52,8 +57,21 @@ Item { // Settings live inline on this plugin's entry in shell.json's `plugins[]`, // per the shell's storage rules. + // Third-party plugins get a scoped `shell` without `shellConfig`, so read + // shell.json directly when the shell does not hand it over. + FileView { + id: shellJson + path: Quickshell.env("HOME") + "/.config/omarchy/shell.json" + watchChanges: true + onFileChanged: reload() + } + readonly property var fileConfig: { + try { return JSON.parse(shellJson.text()) } catch (e) { return null } + } + readonly property var config: { - var settings = shell && shell.shellConfig ? shell.shellConfig.plugins : null + var source = shell && shell.shellConfig ? shell.shellConfig : root.fileConfig + var settings = source ? source.plugins : null if (Array.isArray(settings)) { for (var i = 0; i < settings.length; i++) { if (settings[i] && String(settings[i].id || "") === root.pluginId) return settings[i]