Plugin cloning via menu (#6433)
* Add plugin cloning via menu * Split plugin commands by action * Keep plugin enablement in action commands * Remove unused plugin edit command * Simplify plugin rescan arguments * Assume Omarchy shell is running for plugin commands * Remove plugin compatibility dispatcher * Flatten plugin clone command * Keep only shared plugin helpers * Remove plugin rescan wrapper * Keep plugin commands self-contained * Simplify plugin clone lifecycle
This commit is contained in:
@@ -53,6 +53,28 @@ cp -a "$ROOT/shell" "$test_root/shell"
|
||||
ln -s "$ROOT/config" "$test_root/config"
|
||||
ln -s "$ROOT/bin" "$test_root/bin"
|
||||
|
||||
hot_reload_dir="$test_home/.config/omarchy/plugins/local.hot-reload"
|
||||
mkdir -p "$hot_reload_dir"
|
||||
cat >"$hot_reload_dir/manifest.json" <<'JSON'
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "local.hot-reload",
|
||||
"name": "Before Hot Reload",
|
||||
"version": "1.0.0",
|
||||
"kinds": ["overlay"],
|
||||
"entryPoints": {"overlay": "Overlay.qml"},
|
||||
"omarchy": {"clonedFrom": "omarchy.emojis"}
|
||||
}
|
||||
JSON
|
||||
cat >"$hot_reload_dir/Overlay.qml" <<'QML'
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
function open(payloadJson) {}
|
||||
function close() {}
|
||||
}
|
||||
QML
|
||||
|
||||
cat >"$stub_bin/omarchy-update-available" <<'SH'
|
||||
#!/bin/bash
|
||||
echo "Omarchy update available (test)"
|
||||
@@ -116,6 +138,31 @@ jq -e '
|
||||
}
|
||||
pass "shell IPC lists plugin metadata"
|
||||
|
||||
jq '.name = "After Hot Reload"' "$hot_reload_dir/manifest.json" >"$hot_reload_dir/manifest.json.tmp"
|
||||
mv "$hot_reload_dir/manifest.json.tmp" "$hot_reload_dir/manifest.json"
|
||||
|
||||
hot_reload_name=""
|
||||
for _ in {1..80}; do
|
||||
hot_reload_name=$(shell_ipc shell listPlugins 2>/dev/null |
|
||||
jq -r '.[] | select(.id == "local.hot-reload") | .name' 2>/dev/null || true)
|
||||
[[ $hot_reload_name == "After Hot Reload" ]] && break
|
||||
if ! kill -0 "$QS_PID" 2>/dev/null; then
|
||||
fail_with_log "test shell exited while reloading a changed local clone"
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
[[ $hot_reload_name == "After Hot Reload" ]] ||
|
||||
fail_with_log "local clone changes reload without an explicit rescan"
|
||||
pass "local clone changes reload without an explicit rescan"
|
||||
|
||||
[[ $(shell_ipc shell setPluginEnabled local.hot-reload true) == "ok" ]] ||
|
||||
fail_with_log "local clone could not be enabled"
|
||||
[[ $(shell_ipc shell summon omarchy.emojis "{}") == "ok" ]] ||
|
||||
fail_with_log "calls to a cloned source id do not reach its enabled clone"
|
||||
shell_ipc_quiet shell hide omarchy.emojis >/dev/null
|
||||
shell_ipc_quiet shell setPluginEnabled local.hot-reload false >/dev/null
|
||||
pass "shell IPC routes built-in ids to enabled clones"
|
||||
|
||||
shell_config=$(shell_ipc shell listShellConfig)
|
||||
jq -e '
|
||||
.version == 1 and
|
||||
|
||||
Reference in New Issue
Block a user