mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Resolve first-party widgets relative to the shell.qml directory
Quickshell.shellDir points at the directory holding the loaded
shell.qml, so the bar can find its own widgets and bar-defaults.json
without depending on OMARCHY_PATH being set in the environment. The
old behaviour silently fell back to ~/.local/share/omarchy when the
env var was unset, which is fine for the installed shell but caused
'No such file or directory' for every first-party widget when running
quickshell -p straight from the repo.
- firstPartyWidgetSource now uses Qt.resolvedUrl("widgets/<name>.qml")
so the resolution is anchored to shell.qml itself.
- deriveOmarchyPath() in both bar/shell.qml and bar-settings/shell.qml
walks back from Quickshell.shellDir to find the omarchy root, with
OMARCHY_PATH still allowed as an explicit override and the install
default as a final fallback.
This commit is contained in:
@@ -8,7 +8,15 @@ ShellRoot {
|
||||
id: root
|
||||
|
||||
property string home: Quickshell.env("HOME")
|
||||
property string omarchyPath: Quickshell.env("OMARCHY_PATH") || (home + "/.local/share/omarchy")
|
||||
function deriveOmarchyPath() {
|
||||
var env = Quickshell.env("OMARCHY_PATH")
|
||||
if (env) return env
|
||||
var dir = String(Quickshell.shellDir || "")
|
||||
if (dir.indexOf("/default/quickshell/bar-settings") !== -1)
|
||||
return dir.substring(0, dir.indexOf("/default/quickshell/bar-settings"))
|
||||
return home + "/.local/share/omarchy"
|
||||
}
|
||||
property string omarchyPath: deriveOmarchyPath()
|
||||
readonly property string userConfigPath: home + "/.config/omarchy/bar.json"
|
||||
readonly property string defaultsPath: omarchyPath + "/default/quickshell/bar/bar-defaults.json"
|
||||
|
||||
|
||||
@@ -14,7 +14,18 @@ ShellRoot {
|
||||
id: root
|
||||
|
||||
property string home: Quickshell.env("HOME")
|
||||
property string omarchyPath: Quickshell.env("OMARCHY_PATH") || (home + "/.local/share/omarchy")
|
||||
// Derive omarchyPath from the loaded shell.qml's directory so the bar finds
|
||||
// its own widgets/defaults regardless of where it was launched. shellDir is
|
||||
// `<omarchyPath>/default/quickshell/bar` so strip three trailing segments.
|
||||
function deriveOmarchyPath() {
|
||||
var env = Quickshell.env("OMARCHY_PATH")
|
||||
if (env) return env
|
||||
var dir = String(Quickshell.shellDir || "")
|
||||
if (dir.indexOf("/default/quickshell/bar") !== -1)
|
||||
return dir.substring(0, dir.indexOf("/default/quickshell/bar"))
|
||||
return home + "/.local/share/omarchy"
|
||||
}
|
||||
property string omarchyPath: deriveOmarchyPath()
|
||||
property string omarchyConfigDir: home + "/.config/omarchy"
|
||||
property var builtinBarConfig: ({
|
||||
position: "top",
|
||||
@@ -320,7 +331,7 @@ ShellRoot {
|
||||
|
||||
function firstPartyWidgetSource(name) {
|
||||
if (!firstPartyWidgets[String(name)]) return ""
|
||||
return fileUrl(omarchyPath + "/default/quickshell/bar/widgets/" + String(name) + ".qml")
|
||||
return Qt.resolvedUrl("widgets/" + String(name) + ".qml")
|
||||
}
|
||||
|
||||
function networkCommand() {
|
||||
|
||||
Reference in New Issue
Block a user