diff --git a/misc/userscripts/dmenu_qutebrowser b/misc/userscripts/dmenu_qutebrowser new file mode 100755 index 000000000..5da1d8462 --- /dev/null +++ b/misc/userscripts/dmenu_qutebrowser @@ -0,0 +1,31 @@ +#!/bin/bash + +# Pipes history, quickmarks, and URL into dmenu. +# +# If run from qutebrowser as a userscript, it runs :open on the URL +# If not, it opens a new qutebrowser window at the URL +# +# Ideal for use with tabs-are-windows. Set a hotkey to launch this script, then: +# :bind o spawn --userscript dmenu_qutebrowser +# +# Use the hotkey to open in new tab/window, press 'o' to open URL in current tab/window +# You can simulate "go" by pressing "o", as the current URL is always first in the list +# +# I personally use "q" to launch this script. For me, my workflow is: +# Default keys Keys with this script +# O q +# o o +# go o +# gO [ I haven't decided what to do with this yet ] +# + +url=$(echo "$QUTE_URL" | cat - ~/.local/share/qutebrowser/history ~/.config/qutebrowser/quickmarks | dmenu -l 15 -p qutebrowser) +url=$(echo $url | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo $url) + +[ -z "${url// }" ] && exit + +if [ -n "$QUTE_FIFO" ]; then + echo "open $url" >> "$QUTE_FIFO" +else + qutebrowser "$url" +fi diff --git a/misc/userscripts/qutebrowser_viewsource b/misc/userscripts/qutebrowser_viewsource new file mode 100755 index 000000000..891d09dce --- /dev/null +++ b/misc/userscripts/qutebrowser_viewsource @@ -0,0 +1,13 @@ +#!/bin/bash + +# +# This script fetches the unprocessed HTML source for a page and opens it in vim. +# :bind gf spawn --userscript qutebrowser_viewsource +# + +path=/tmp/qutebrowser-src_$(date "+%s") + +curl "$QUTE_URL" > $path +urxvt -e vim "$path" + +rm "$path"