Skip to content

Commit

Permalink
[scripts] ,linkify: pipe through mdclip instead of pbcopy
Browse files Browse the repository at this point in the history
This ensures both text and html clipboard is set
  • Loading branch information
meain committed Jan 16, 2025
1 parent 376f137 commit 04bc0b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/.local/bin/random/,linkify
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ url="$1"
[ -z "$url" ] && url="$(pbpaste)"

if ! echo "$url" | grep -qE '^https?://'; then
echo Not a link
exit 1
echo "$url" | mdclip
exit 0
fi

get_title() {
Expand Down Expand Up @@ -53,7 +53,7 @@ else

[ -z "$title" ] && title="$url"
printf "[%s](%s)" "$title" "$url"
fi | tee /tmp/linkify | pbcopy
fi | tee /tmp/linkify | mdclip

title="$(cat /tmp/linkify | sed 's|.*\[\(.*\)\](.*)|\1|')"
notify "$title" "$url"
Expand Down

0 comments on commit 04bc0b8

Please sign in to comment.