]> git.armaanb.net Git - bin.git/commitdiff
dweb: transform from bookmarks
authorArmaan Bhojwani <me@armaanb.net>
Tue, 22 Jun 2021 01:32:51 +0000 (21:32 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 22 Jun 2021 01:32:51 +0000 (21:32 -0400)
bookmarks [deleted file]
dweb [new file with mode: 0755]
man/bookmarks.1.scd [deleted file]
man/dweb.1.scd [new file with mode: 0644]

diff --git a/bookmarks b/bookmarks
deleted file mode 100755 (executable)
index 6556d55..0000000
--- a/bookmarks
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env sh
-
-cat ${1:-~/org/bookmarks} | dmenu -l 20 | xargs xdg-open
\ No newline at end of file
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')
+
diff --git a/man/bookmarks.1.scd b/man/bookmarks.1.scd
deleted file mode 100644 (file)
index 67fa1fc..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-bookmarks(1)
-
-# NAME
-bookmarks - select a bookmark with dmenu
-
-# SYNOPSIS
-*bookmarks*++
-*bookmarks [path to bookmarks file]*
-
-# DESCRIPTION
-Allows you to select a bookmark from a list of newline delimited urls (defaults
-to ~/org/bookmarks) and open it in the default browser.
-
-# COPYRIGHT
-This is free and unencumbered software released into the public domain. For more
-information, please refer to <https://unlicense.org/>.
diff --git a/man/dweb.1.scd b/man/dweb.1.scd
new file mode 100644 (file)
index 0000000..e265a2a
--- /dev/null
@@ -0,0 +1,31 @@
+dweb(1)
+
+# NAME
+dweb - dynamic prompt to browse the web
+
+# SYNOPSIS
+*dweb* bookmark++
+*dweb* bookmark [path to bookmarks file]++
+*dweb* help++
+*dweb* search++
+*dweb* uri
+
+# DESCRIPTION
+Launches a dmenu prompting you based on the subcommand.
+
+*bookmark*
+       Allows you to select a bookmark from a list of newline delimited
+       urls (defaults to ~/org/bookmarks) and open it in the default browser.
+
+*help*
+       Show help information.
+
+*search*
+       Search the web using a search engine.
+
+*uri*
+       Open a URI.
+
+# COPYRIGHT
+This is free and unencumbered software released into the public domain. For more
+information, please refer to <https://unlicense.org/>.