Open links from QR payloads: Ctrl+O opens the decoded URL (browser) instead of the image; clickable Open-link chips in link and QR previews

This commit is contained in:
2026-09-05 22:56:26 +01:00
parent 66ba5bd3db
commit 6da0c42847
6 changed files with 123 additions and 2 deletions
+11
View File
@@ -38,6 +38,17 @@ open_text() {
case $(jq -r '.type' <<<"$entry") in
image)
path=$(jq -r '.path' <<<"$entry")
# A decoded QR payload often IS a link — opening it beats opening the image.
qr=$(jq -r '.qr // empty' <<<"$entry")
if [[ -n $qr ]]; then
url=$(printf '%s' "$qr" | grep -Eom1 'https?://[^[:space:]"<>]+' || true)
if [[ -z $url ]] && [[ $qr =~ ^[[:alnum:]][[:alnum:].-]*\.[[:alpha:]]{2,}(/[^[:space:]]*)?[[:space:]]*$ ]]; then
url="https://${BASH_REMATCH[0]}"
fi
if [[ -n $url ]]; then
exec omarchy-launch-browser "$url"
fi
fi
[[ -r $path ]] || exit 0
if command -v tensaku-edit >/dev/null 2>&1; then
exec tensaku-edit "$path"