X-Git-Url: https://git.danieliu.xyz/?p=dotfiles.git;a=blobdiff_plain;f=Scripts%2Fplumb;fp=Scripts%2Fplumb;h=f60994e7bb18a23b346836d4fb0e2fb28ba6f5b2;hp=0000000000000000000000000000000000000000;hb=faceca157243883952e2c3b4e201fff3c0562dd1;hpb=bea758d3a4f0fe9ff27425b3a0444759ed049693 diff --git a/Scripts/plumb b/Scripts/plumb new file mode 100755 index 0000000..f60994e --- /dev/null +++ b/Scripts/plumb @@ -0,0 +1,12 @@ +#!/bin/sh + +openlink() { + [ -z "$BROWSER" ] && exit 1 + $BROWSER "$1" +} + +link=$(echo "$2" | grep -P "https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\//=]*)") >/dev/null 2>&1 +[ -n "$link" ] && openlink "$link" && notify-send "Opening Link: $link" + + +