QR decode support (zbarimg) with searchable payload + preview panel; restructure repo root as installable omarchy plugin; plain-text safety for QR payloads

This commit is contained in:
2026-09-05 16:22:10 +01:00
parent 63a003e4a5
commit 1aac582e90
15 changed files with 144 additions and 16 deletions
Executable
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# Paste (or just copy) a history entry from the tank.clipboard store.
# Usage: paste-entry.sh <entry-id> [--copy-only]
set -euo pipefail
STATE="$HOME/.local/state/omarchy/clipboard-history-rich.json"
ID="${1:-}"
MODE="${2:-}"
[[ -n $ID && -r $STATE ]] || exit 0
entry=$(jq -c --arg id "$ID" '[.[] | select(.id == $id)][0]' "$STATE") || exit 0
[[ $entry != "null" && -n $entry ]] || exit 0
type=$(jq -r '.type' <<<"$entry")
case "$type" in
image)
path=$(jq -r '.path' <<<"$entry")
mime=$(jq -r '.mime // "image/png"' <<<"$entry")
[[ -r $path ]] || exit 0
wl-copy --type "$mime" <"$path"
;;
files)
while IFS= read -r p; do
printf 'file://%s\n' "$(python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$p")"
done < <(jq -r '.paths[]' <<<"$entry") | wl-copy --type text/uri-list
;;
*)
jq -j '.text' <<<"$entry" | wl-copy
;;
esac
[[ $MODE == "--copy-only" ]] && exit 0
# Give the layer surface a moment to close and focus to fall back to the
# previously-focused window, then paste via the universal Shift+Insert.
sleep 0.15
wtype -M shift -k Insert -m shift 2>/dev/null || true