Installer: transparent dependency check/install (--skip-deps), idempotent rebind; picker notifies when QR/OCR helper binaries are missing

This commit is contained in:
2026-09-05 23:34:52 +01:00
parent 2e6a2e8da1
commit a2ed301bb0
2 changed files with 26 additions and 2 deletions
+1
View File
@@ -374,6 +374,7 @@ Item {
onFileChanged: reload() onFileChanged: reload()
} }
Process { id: depsProc }
Process { Process {
id: gcProc id: gcProc
onExited: runNextGc() onExited: runNextGc()
+25 -2
View File
@@ -4,7 +4,8 @@
# - symlinks the repo root (the plugin folder) into ~/.config/omarchy/plugins/alanfortlink.clipboard # - symlinks the repo root (the plugin folder) into ~/.config/omarchy/plugins/alanfortlink.clipboard
# - rescans + enables it (shell.json gets plugins[] entry; the built-in # - rescans + enables it (shell.json gets plugins[] entry; the built-in
# omarchy.clipboard is recorded in disabledPlugins[] and routed here) # omarchy.clipboard is recorded in disabledPlugins[] and routed here)
# - rebinds ALT+SHIFT+V from vicinae to this picker (backs up bindings.conf) # - checks and installs dependencies transparently (QR/OCR degrade without them)
# - rebinds ALT+SHIFT+V from vicinae to this picker (backs up bindings.lua/.conf)
set -euo pipefail set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -13,6 +14,25 @@ PLUGINS_DIR="$HOME/.config/omarchy/plugins"
PLUGIN_ID="alanfortlink.clipboard" PLUGIN_ID="alanfortlink.clipboard"
BINDINGS="$HOME/.config/hypr/bindings.conf" BINDINGS="$HOME/.config/hypr/bindings.conf"
echo "==> Checking dependencies"
SKIP_DEPS=false
for a in "$@"; do [[ $a == --skip-deps ]] && SKIP_DEPS=true; done
missing=()
command -v python3 >/dev/null 2>&1 || missing+=("python3")
command -v jq >/dev/null 2>&1 || missing+=("jq")
command -v wl-copy >/dev/null 2>&1 || missing+=("wl-clipboard")
command -v wtype >/dev/null 2>&1 || missing+=("wtype")
command -v zbarimg >/dev/null 2>&1 || missing+=("zbar") # QR decode
command -v tesseract >/dev/null 2>&1 || missing+=("tesseract") # OCR search
if [[ $SKIP_DEPS == true ]]; then
echo " skipped (--skip-deps)"
elif (( ${#missing[@]} > 0 )); then
echo " installing missing packages (nothing hidden): ${missing[*]}"
omarchy pkg add "${missing[@]}" || echo " WARNING: install failed — QR/OCR degrade gracefully without them"
else
echo " all present: wl-clipboard, jq, python3, wtype, zbar, tesseract"
fi
echo "==> Linking plugin into $PLUGINS_DIR/$PLUGIN_ID" echo "==> Linking plugin into $PLUGINS_DIR/$PLUGIN_ID"
mkdir -p "$PLUGINS_DIR" mkdir -p "$PLUGINS_DIR"
ln -sTfn "$PLUGIN_DIR" "$PLUGINS_DIR/$PLUGIN_ID" ln -sTfn "$PLUGIN_DIR" "$PLUGINS_DIR/$PLUGIN_ID"
@@ -44,7 +64,10 @@ echo "==> Rebinding ALT+SHIFT+V"
rebound=0 rebound=0
if [[ -f $HOME/.config/hypr/bindings.lua ]]; then if [[ -f $HOME/.config/hypr/bindings.lua ]]; then
LUA="$HOME/.config/hypr/bindings.lua" LUA="$HOME/.config/hypr/bindings.lua"
if grep -q 'ALT + SHIFT + V' "$LUA"; then if grep -q 'omarchy-shell shell toggle alanfortlink.clipboard' "$LUA"; then
echo " bindings.lua already points at alanfortlink.clipboard"
rebound=1
elif grep -q 'ALT + SHIFT + V' "$LUA"; then
cp "$LUA" "$LUA.bak.$(date +%s)" cp "$LUA" "$LUA.bak.$(date +%s)"
sed -i 's|^o.bind("ALT + SHIFT + V", "Clipboard manager (vicinae)", "vicinae deeplink vicinae://launch/clipboard/history")|o.bind("ALT + SHIFT + V", "Clipboard manager (clipboard-history)", "omarchy-shell shell toggle alanfortlink.clipboard")|' "$LUA" sed -i 's|^o.bind("ALT + SHIFT + V", "Clipboard manager (vicinae)", "vicinae deeplink vicinae://launch/clipboard/history")|o.bind("ALT + SHIFT + V", "Clipboard manager (clipboard-history)", "omarchy-shell shell toggle alanfortlink.clipboard")|' "$LUA"
echo " rebound in bindings.lua (vicinae binding replaced)" echo " rebound in bindings.lua (vicinae binding replaced)"