diff --git a/bin/omarchy-menu-plugin b/bin/omarchy-menu-plugin index 9b4800df..7182c6eb 100755 --- a/bin/omarchy-menu-plugin +++ b/bin/omarchy-menu-plugin @@ -12,7 +12,7 @@ PLUGIN_ICON=$'\U000f0431' case "${1:-}" in enable) filter='(.enabled | not)' ;; disable) filter='.canDisable and .enabled' ;; - clone) filter='.firstParty and ((.id | sub("^omarchy\\."; "local.")) as $clone_id | ($plugins | map(.id) | index($clone_id)) == null)' ;; + clone) filter='.firstParty and (.id as $id | ($plugins | map(.clonedFrom // "") | index($id)) == null)' ;; remove) filter='(.firstParty | not)' ;; *) echo "Usage: omarchy-menu-plugin " >&2 @@ -40,10 +40,8 @@ id=$(awk -F'\t' -v label="$name" '$2 == label { print $3; exit }' <<<"$rows") [[ -n $id ]] || exit 1 if [[ $1 == "clone" ]]; then - new_id="local.${id#omarchy.}" - target="$HOME/.config/omarchy/plugins/$new_id" omarchy-launch-floating-terminal-with-presentation \ - "omarchy-plugin-clone $(printf '%q' "$id") && exec \$EDITOR $(printf '%q' "$target")" + "omarchy-plugin-clone --edit $(printf '%q' "$id")" elif [[ $1 == "remove" ]]; then omarchy-launch-floating-terminal-with-presentation "omarchy-plugin-remove $(printf '%q' "$id")" else diff --git a/bin/omarchy-plugin-clone b/bin/omarchy-plugin-clone index e645ce69..59ca1617 100755 --- a/bin/omarchy-plugin-clone +++ b/bin/omarchy-plugin-clone @@ -2,7 +2,7 @@ # omarchy:summary=Clone a built-in Omarchy shell plugin into your own config # omarchy:group=plugin -# omarchy:args= +# omarchy:args= [--edit] set -euo pipefail @@ -81,16 +81,19 @@ update_manifest() { usage() { cat < +Usage: omarchy plugin clone [--edit] -Copies a built-in plugin into ~/.config/omarchy/plugins/local./ so you can -edit it freely. The clone keeps all of the source plugin's files and kinds and -uses "My " as its display name, then replaces the built-in with the clone. +Copies a built-in plugin into ~/.config/omarchy/plugins/./ so you +can edit it freely. The clone keeps all of the source plugin's files and kinds +and uses "My " as its display name, then replaces the built-in with the +clone. The username prefix keeps the id yours, so a shared clone does not +collide with anyone else's. --edit opens the clone in \$EDITOR afterwards. USAGE } source_id="" +edit_clone=0 if (( $# > 0 )) && [[ $1 != --* ]]; then source_id="$1" shift @@ -98,6 +101,10 @@ fi while (( $# > 0 )); do case "$1" in + --edit) + edit_clone=1 + shift + ;; -h | --help) usage exit 0 @@ -121,7 +128,7 @@ source_info=$(omarchy-plugin-catalog | jq -r --arg id "$source_id" ' [[ -n $source_info ]] || fail "unknown built-in plugin: $source_id" IFS=$'\t' read -r source_dir source_manifest source_name <<<"$source_info" -new_id="local.${source_id#omarchy.}" +new_id="${USER:-$(id -un)}.${source_id#omarchy.}" display_name="My $source_name" target_dir="$PLUGINS_DIR/$new_id" [[ ! -e $target_dir && ! -L $target_dir ]] || fail "$target_dir already exists" @@ -155,3 +162,7 @@ omarchy-notification-send -g 󰐱 \ "Editing Cloned Plugin" \ "Original plugin has been replace by clone." echo "Cloned $source_id to $target_dir and switched to $new_id" +if (( edit_clone )); then + # Word-splitting is deliberate: EDITOR may carry flags. + exec $EDITOR "$target_dir" +fi diff --git a/default/omarchy-skill/SKILL.md b/default/omarchy-skill/SKILL.md index 7bd905b1..8cb227ae 100644 --- a/default/omarchy-skill/SKILL.md +++ b/default/omarchy-skill/SKILL.md @@ -184,7 +184,7 @@ Clone it into the user plugin directory instead: ```bash omarchy plugin clone omarchy.workspaces -# Edit ~/.config/omarchy/plugins/local.workspaces/; saved changes reload automatically. +# Edit ~/.config/omarchy/plugins/.workspaces/; saved changes reload automatically. ``` **Commands:** `omarchy restart shell`, `omarchy refresh shell` @@ -419,6 +419,6 @@ This skill intentionally does not cover Omarchy source development. Do not use t - "Clear all reminders" -> `omarchy reminder clear` - "Customize the catppuccin theme colors" -> Create `~/.config/omarchy/themes/catppuccin-custom/` by copying from stock, then edit - "Run a script every time I change themes" -> Install it with `omarchy hook install theme-set