Installer: transparent dependency check/install (--skip-deps), idempotent rebind; picker notifies when QR/OCR helper binaries are missing
This commit is contained in:
+25
-2
@@ -4,7 +4,8 @@
|
||||
# - symlinks the repo root (the plugin folder) into ~/.config/omarchy/plugins/alanfortlink.clipboard
|
||||
# - rescans + enables it (shell.json gets plugins[] entry; the built-in
|
||||
# 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
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -13,6 +14,25 @@ PLUGINS_DIR="$HOME/.config/omarchy/plugins"
|
||||
PLUGIN_ID="alanfortlink.clipboard"
|
||||
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"
|
||||
mkdir -p "$PLUGINS_DIR"
|
||||
ln -sTfn "$PLUGIN_DIR" "$PLUGINS_DIR/$PLUGIN_ID"
|
||||
@@ -44,7 +64,10 @@ echo "==> Rebinding ALT+SHIFT+V"
|
||||
rebound=0
|
||||
if [[ -f $HOME/.config/hypr/bindings.lua ]]; then
|
||||
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)"
|
||||
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)"
|
||||
|
||||
Reference in New Issue
Block a user