]> git.armaanb.net Git - bin.git/blobdiff - dweb
dweb: transform from bookmarks
[bin.git] / dweb
diff --git a/dweb b/dweb
new file mode 100755 (executable)
index 0000000..7f0fc01
--- /dev/null
+++ b/dweb
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+
+engine="https://duckduckgo.com?q="
+
+case "$1" in
+               uri)
+                               :| dmenu -p "Open a URL:" | xargs -I % chorizo "%"
+                               ;;
+               bookmark)
+                               cat ${2:-~/org/bookmarks} | dmenu -l 20 -p "Open a bookmark:" \
+                                               | xargs -I % chorizo "%"
+                               ;;
+               search)
+                               :| dmenu -p "Search the web:" | xargs -I % chorizo "$engine%"
+                               ;;
+               -h|--help|help)
+                               echo "$0 [bookmark|help|search|uri]"
+                               exit 0
+                               ;;
+               *)
+                               echo "No such option. See \"$0 help\" for more information."
+                               exit 1
+                               ;;
+esac
+
+input=$(echo "$input" | tr -d '\n')
+