diff options
author | Urbain Vaes <urbain@vaes.uk> | 2016-03-10 14:29:06 +0000 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2016-03-10 14:29:06 +0000 |
commit | 3446f5387389b0e1671481c8a8fb9ea0eed519f6 (patch) | |
tree | 543bde435847c700507c3b229460b446f4a09028 /qutebrowser/userscripts | |
parent | c9f80e43f431d89bbccd1ecc68c7b48fb8c01dd4 (diff) |
Remove . from dotfiles for convenience
Diffstat (limited to 'qutebrowser/userscripts')
-rwxr-xr-x | qutebrowser/userscripts/bookmarks-dmenu | 7 | ||||
-rwxr-xr-x | qutebrowser/userscripts/quickmarks-dmenu | 7 | ||||
-rwxr-xr-x | qutebrowser/userscripts/url-from-surfraw | 20 |
3 files changed, 34 insertions, 0 deletions
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/quickmarks-dmenu b/qutebrowser/userscripts/quickmarks-dmenu new file mode 100755 index 0000000..354b398 --- /dev/null +++ b/qutebrowser/userscripts/quickmarks-dmenu @@ -0,0 +1,7 @@ +#!/bin/bash + +url=$(cat ~/.config/qutebrowser/quickmarks | dmenu -i -l 15 | awk '{print $NF}') + +[ -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..9bd6795 --- /dev/null +++ b/qutebrowser/userscripts/url-from-surfraw @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +DEFAULT_SEARCH=startpage + +if [[ $1 =~ ^-.$ ]]; then + option="$1" + shift 1 +fi + +is_elvi=$(surfraw -elvi | grep -c "^$1\s") +nbr_words=$(echo $1 | wc -w) + +if [[ $is_elvi -eq 0 && $nbr_words -eq 1 && ($1 == *.* || $1 == *:*) ]]; then + url="$1" +else + [[ $is_elvi -eq 0 ]] && sr="$DEFAULT_SEARCH $*" || sr=$* + url=$(surfraw -print $sr) +fi + +echo "open $option $url" >> $QUTE_FIFO |