Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Arrange.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ Item {
readonly property string configHome: Quickshell.env("XDG_CONFIG_HOME") || (home + "/.config")
readonly property string monitorsPath: configHome + "/hypr/monitors.lua"
//: Where this plugin was loaded from, for the scripts shipped beside it.
readonly property string pluginDir: manifest && manifest.__sourceDir
? String(manifest.__sourceDir) : ""
//: Third-party manifests do not carry the host's private `__sourceDir`
//: (Omarchy 4.0.3 sanitizes it), so resolve from this file at the root.
readonly property string pluginDir: {
var url = String(Qt.resolvedUrl("."))
if (url.indexOf("file://") !== 0) return ""
try { return decodeURIComponent(url.substring(7)).replace(/\/$/, "") } catch (e) { return "" }
}

function touch() { revision += 1 }

Expand Down
8 changes: 4 additions & 4 deletions LauncherEntry.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ QtObject {
id: root

property var manifest: null
property string pluginDir: ""

readonly property string dest:
Quickshell.env("HOME") + "/.local/share/applications/displaywright.desktop"
Expand Down Expand Up @@ -53,7 +54,7 @@ QtObject {
// Component.onCompleted, so the paths are built when it arrives rather than
// bound -- a binding has not re-evaluated by the time that fires.
onManifestChanged: {
var dir = manifest && manifest.__sourceDir
var dir = root.pluginDir
if (installed || !dir) return
installed = true
//: execDetached reports nothing back, so this line is the only evidence
Expand All @@ -66,11 +67,10 @@ QtObject {

Component.onDestruction: {
if (!installed) return
var dir = manifest && manifest.__sourceDir
//: No folder to test means no way to tell a reload from a removal, and
//: keeping the entry is the half that cannot lose one.
if (!dir) return
if (!root.pluginDir) return
Quickshell.execDetached(["sh", "-c", removeScript, "sh",
dest, marker, dir + "/manifest.json"])
dest, marker, root.pluginDir + "/manifest.json"])
}
}
17 changes: 11 additions & 6 deletions Wallpaper.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Item {
//: A plain child rather than a typed property: resolving a sibling .qml as
//: a property *type* is stricter than instantiating it, and this file is
//: the one whose failure takes every wallpaper on the desktop with it.
LauncherEntry { manifest: root.manifest }
LauncherEntry { manifest: root.manifest; pluginDir: root.pluginDir }

//: A plain-value snapshot of the shell theme, for the same reason.
readonly property var palette: ({
Expand All @@ -67,11 +67,16 @@ Item {
readonly property string configHome: Quickshell.env("XDG_CONFIG_HOME") || (home + "/.config")
readonly property string configPath: configHome + "/displaywright/wallpapers.json"

// Where this plugin was loaded from. The shell stamps it into the manifest;
// hardcoding an install path would break a symlinked checkout and anyone who
// installed by hand somewhere else.
readonly property string pluginDir: manifest && manifest.__sourceDir
? String(manifest.__sourceDir) : ""
// Where this plugin was loaded from: this file sits at the plugin root, so
// the directory resolves from here. Third-party manifests do not carry the
// host's private `__sourceDir` (Omarchy 4.0.3 sanitizes it), and hardcoding
// an install path would break a symlinked checkout and anyone who installed
// by hand somewhere else.
readonly property string pluginDir: {
var url = String(Qt.resolvedUrl("."))
if (url.indexOf("file://") !== 0) return ""
try { return decodeURIComponent(url.substring(7)).replace(/\/$/, "") } catch (e) { return "" }
}

// ---------------------------------------------------------------- config

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "ai.bkblab.displaywright",
"name": "Displaywright",
"version": "0.7.3",
"version": "0.7.4",
"author": "bkblab.ai",
"license": "MIT",
"description": "Per-display wallpapers and a display arrangement editor, inside omarchy-shell. Open it from the Apps menu: SUPER+ALT+SPACE, then type Displays. Or double-click one display's background to give just that display a wallpaper.",
Expand Down