xresources clean + vim
[dotfiles.git] / Scripts / plumb
diff --git a/Scripts/plumb b/Scripts/plumb
new file mode 100755 (executable)
index 0000000..f60994e
--- /dev/null
@@ -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"
+
+
+