diff options
author | Urbain Vaes <urbain@vaes.uk> | 2016-03-04 01:40:26 +0000 |
---|---|---|
committer | Urbain Vaes <urbain@vaes.uk> | 2016-03-04 01:40:26 +0000 |
commit | 4393b8b173c0910f37734dc8fbc7acade0547542 (patch) | |
tree | 6838a1bc83f22031cc898e2ab699b81d6bd4f55f /.qutebrowser | |
parent | 05ae7f24a08be580638ca4cc843ac47cf4038016 (diff) |
Add scripts in qutebrowser config
Diffstat (limited to '.qutebrowser')
-rw-r--r-- | .qutebrowser/bookmarks/urls | 2 | ||||
-rw-r--r-- | .qutebrowser/keys.conf | 33 | ||||
-rw-r--r-- | .qutebrowser/qutebrowser.conf | 4 | ||||
-rwxr-xr-x | .qutebrowser/userscripts/bookmarks-dmenu | 7 | ||||
-rwxr-xr-x | .qutebrowser/userscripts/url-from-surfraw | 20 |
5 files changed, 45 insertions, 21 deletions
diff --git a/.qutebrowser/bookmarks/urls b/.qutebrowser/bookmarks/urls index 61c9dfc..5496130 100644 --- a/.qutebrowser/bookmarks/urls +++ b/.qutebrowser/bookmarks/urls @@ -1 +1,3 @@ https://www.urbainvaes.com Urbain Vaes +https://www.stallman.org/ Richard Stallman's Personal Page +https://news.ycombinator.com/ Hacker News diff --git a/.qutebrowser/keys.conf b/.qutebrowser/keys.conf index ee0933b..359789e 100644 --- a/.qutebrowser/keys.conf +++ b/.qutebrowser/keys.conf @@ -50,7 +50,7 @@ clear-keychain ;; leave-mode clear-keychain ;; search <Escape> -set-cmd-text -s :open +set-cmd-text -s :spawn --userscript url-from-surfraw o set-cmd-text :open {url} @@ -198,10 +198,6 @@ scroll up scroll right l -undo - u - <Ctrl-Shift-T> - scroll-perc 0 gg @@ -259,9 +255,6 @@ paste -ws quickmark-save m -set-cmd-text -s :quickmark-load - b - set-cmd-text -s :quickmark-load -t B @@ -271,8 +264,8 @@ set-cmd-text -s :quickmark-load -w bookmark-add M -set-cmd-text -s :bookmark-load - gb +spawn --userscript bookmarks-dmenu + u set-cmd-text -s :bookmark-load -t gB @@ -403,7 +396,6 @@ open qute:settings follow-selected <Return> <Ctrl-M> - # <Ctrl-J> <Shift-Return> <Enter> <Shift-Enter> @@ -412,6 +404,15 @@ follow-selected -t <Ctrl-Return> <Ctrl-Enter> +set-cmd-text -s :bookmark-load + gb + +undo + <Ctrl-Shift-T> + +set-cmd-text -s :quickmark-load + b + [insert] # Keybindings for insert mode. # Since normal keypresses are passed through, only special keys are @@ -432,7 +433,6 @@ open-editor follow-hint <Return> <Ctrl-M> - # <Ctrl-J> <Shift-Return> <Enter> <Shift-Enter> @@ -459,19 +459,17 @@ hint all tab-bg command-history-prev <Ctrl-K> + <Up> command-history-next <Ctrl-J> + <Down> completion-item-prev <Ctrl-P> - # <Shift-Tab> - <Up> completion-item-next <Ctrl-N> - # <Tab> - <Down> completion-item-del <Ctrl-D> @@ -479,7 +477,6 @@ completion-item-del command-accept <Return> <Ctrl-M> - # <Ctrl-J> <Shift-Return> <Enter> <Shift-Enter> @@ -497,7 +494,6 @@ command-accept prompt-accept <Return> <Ctrl-M> - # <Ctrl-J> <Shift-Return> <Enter> <Shift-Enter> @@ -614,7 +610,6 @@ yank-selected y <Return> <Ctrl-M> - # <Ctrl-J> <Shift-Return> <Enter> <Shift-Enter> diff --git a/.qutebrowser/qutebrowser.conf b/.qutebrowser/qutebrowser.conf index 4827df7..8edd377 100644 --- a/.qutebrowser/qutebrowser.conf +++ b/.qutebrowser/qutebrowser.conf @@ -155,13 +155,13 @@ ignore-case = smart wrap-search = true startpage = https://startpage.com -default-page = ${startpage} +default-page = https://startpage.com auto-search = naive auto-save-config = true auto-save-interval = 15000 editor = urxvt -e vim -f "{}" editor-encoding = utf-8 -private-browsing = false +private-browsing = true developer-extras = false print-element-backgrounds = true xss-auditing = false 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" |