From 4393b8b173c0910f37734dc8fbc7acade0547542 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 4 Mar 2016 01:40:26 +0000 Subject: Add scripts in qutebrowser config --- .qutebrowser/userscripts/bookmarks-dmenu | 7 +++++++ .qutebrowser/userscripts/url-from-surfraw | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 .qutebrowser/userscripts/bookmarks-dmenu create mode 100755 .qutebrowser/userscripts/url-from-surfraw (limited to '.qutebrowser/userscripts') diff --git a/.qutebrowser/userscripts/bookmarks-dmenu b/.qutebrowser/userscripts/bookmarks-dmenu new file mode 100755 index 0000000..0f89413 --- /dev/null +++ b/.qutebrowser/userscripts/bookmarks-dmenu @@ -0,0 +1,7 @@ +#!/bin/bash + +url=$(cat ~/.config/qutebrowser/bookmarks/urls | dmenu -i -l 15 | awk '{print $1}') + +[ -z ${url} ] && exit + +echo "open $url" >> "$QUTE_FIFO" diff --git a/.qutebrowser/userscripts/url-from-surfraw b/.qutebrowser/userscripts/url-from-surfraw new file mode 100755 index 0000000..3aaf30a --- /dev/null +++ b/.qutebrowser/userscripts/url-from-surfraw @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +DEFAULT_SEARCH=startpage + +string="$1 $2" + +set -- $string +is_elvi=$(surfraw -elvi | grep -c "^$1\s") +nbr_words=$(echo "$string" | wc -w) +if [ "$nbr_words" -eq 1 ] && [ "$is_elvi" -eq 0 ] && ([[ "$string" == *.* ]] || [[ "$string" == *:* ]]) +then + url="$1" +elif [ $is_elvi -eq 1 ] +then + url="$(surfraw -print $string)" +else + url="$(surfraw -print $DEFAULT_SEARCH $string)" +fi + +echo "open $url" >> "$QUTE_FIFO" -- cgit v1.2.3