Safety: no auto-browser from text containing URLs (only pure-link entries); row click selects (double-click activates); missing deps shown as picker banner with run-in-terminal button

This commit is contained in:
2026-09-05 23:48:53 +01:00
parent a2ed301bb0
commit 6b0a2ac494
2 changed files with 108 additions and 4 deletions
+6 -1
View File
@@ -22,8 +22,13 @@ open_text() {
if [[ -z $url && $text =~ ^[[:space:]]*([[:alnum:]][[:alnum:].-]+\.[[:alpha:]]{2,})(/[^[:space:]]*)?[[:space:]]*$ ]]; then
url="https://${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
fi
# Only open the browser when the WHOLE entry is that link. Text that merely
# contains a URL — like a copied shell command — must not launch anything.
if [[ -n $url ]]; then
exec omarchy-launch-browser "$url"
local compact=${text//[[:space:]]/}
if [[ ${compact,,} == ${url,,}* ]]; then
exec omarchy-launch-browser "$url"
fi
fi
local dir file
dir="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/clipboard-open"