summaryrefslogtreecommitdiff
path: root/qutebrowser
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2017-06-07 13:04:32 +0100
committerUrbain Vaes <urbain@vaes.uk>2017-06-07 13:04:32 +0100
commit4ef38f411ec198328b5c18ba4b56b1499e4bc798 (patch)
treec385e8e47ce2ae7e6967ae7384775dcebc82e059 /qutebrowser
parent2da45eb37e5207a0a0f62f0714e0f2f3676f3fe3 (diff)
Add script to facilitate qutebrowser navigation
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/.config/qutebrowser/keys.conf21
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/dictionary-search2
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/explorer15
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/history10
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/quickmarks10
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu7
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/tab-switch6
-rwxr-xr-xqutebrowser/.local/share/qutebrowser/userscripts/tabs14
8 files changed, 66 insertions, 19 deletions
diff --git a/qutebrowser/.config/qutebrowser/keys.conf b/qutebrowser/.config/qutebrowser/keys.conf
index 8fd0d48..c7555a1 100644
--- a/qutebrowser/.config/qutebrowser/keys.conf
+++ b/qutebrowser/.config/qutebrowser/keys.conf
@@ -55,8 +55,17 @@ set-cmd-text -s :spawn --userscript url-from-surfraw
set-cmd-text -s :spawn --userscript url-from-surfraw -t
t
-spawn --userscript tab-switch
- T
+spawn --userscript explorer -b
+ eb
+
+spawn --userscript explorer -h
+ eh
+
+spawn --userscript explorer -t
+ et
+
+spawn --userscript explorer
+ b
spawn mpv {url}
y
@@ -260,9 +269,6 @@ set-cmd-text -s :quickmark-load -w
bookmark-add
M
-spawn --userscript quickmarks-dmenu
- b
-
set-cmd-text -s :bookmark-load -t
gB
@@ -460,6 +466,9 @@ forward -w
fullscreen
<f11>
+set-cmd-text -s :quickmark-load
+ xxb
+
[insert]
# Keybindings for insert mode.
# Since normal keypresses are passed through, only special keys are
@@ -716,6 +725,8 @@ scroll up
scroll right
L
+[caret,normal]
+
spawn --userscript dictionary-search
gD
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search b/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search
index 3155c91..cb9ad7d 100755
--- a/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search
+++ b/qutebrowser/.local/share/qutebrowser/userscripts/dictionary-search
@@ -1,3 +1,3 @@
#!/bin/bash
-echo "open -t http://dictionary.cambridge.org/dictionary/english/$QUTE_SELECTED_TEXT" >> "$QUTE_FIFO"
+echo "open -t http://dictionary.cambridge.org/dictionary/english/$QUTE_SELECTED_TEXT" > "$QUTE_FIFO"
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/explorer b/qutebrowser/.local/share/qutebrowser/userscripts/explorer
new file mode 100755
index 0000000..f134aa5
--- /dev/null
+++ b/qutebrowser/.local/share/qutebrowser/userscripts/explorer
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+scripts_dir="$HOME/.local/share/qutebrowser/userscripts"
+rofi_modi="quickmarks:$scripts_dir/quickmarks,tabs:$scripts_dir/tabs,history:$scripts_dir/history"
+rofi_comand="rofi -combi-modi $rofi_modi -modi $rofi_modi -show"
+
+if [[ "$1" = "-t" ]]; then
+ $rofi_comand tabs
+elif [[ "$1" = "-b" ]]; then
+ $rofi_comand quickmarks
+elif [[ "$1" = "-h" ]]; then
+ $rofi_comand history
+else
+ $rofi_comand combi
+fi
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/history b/qutebrowser/.local/share/qutebrowser/userscripts/history
new file mode 100755
index 0000000..2122666
--- /dev/null
+++ b/qutebrowser/.local/share/qutebrowser/userscripts/history
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -n "$1" ]
+then
+ echo "open $(echo $1 | awk '{print $NF}')" >> $QUTE_FIFO
+ exit;
+fi
+
+# List history
+cat ~/.local/share/qutebrowser/history | awk '{print $3 ": " $2}'
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks
new file mode 100755
index 0000000..a55b23b
--- /dev/null
+++ b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ -n "$1" ]
+then
+ echo "open $(echo $1 | awk '{print $NF}')" >> $QUTE_FIFO
+ exit;
+fi
+
+# List of marks
+cat ~/.config/qutebrowser/quickmarks
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu b/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu
deleted file mode 100755
index 354b398..0000000
--- a/qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/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/.local/share/qutebrowser/userscripts/tab-switch b/qutebrowser/.local/share/qutebrowser/userscripts/tab-switch
deleted file mode 100755
index b82ed36..0000000
--- a/qutebrowser/.local/share/qutebrowser/userscripts/tab-switch
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-
-tabs=$(i3-msg -t get_tree | grep -o '"window":[0-9]*[^{]*{[^}]*qutebrowser[^}]*}')
-selected_title=$(echo "$tabs" | sed 's/^.*title":"\(.*\) - qutebrowser.*/\1/g' | dmenu)
-selected_id=$(echo "$tabs" | grep "$selected_title" | sed 's/^.*window":\([0-9]*\).*$/\1/')
-i3-msg "[id=$selected_id] focus"
diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/tabs b/qutebrowser/.local/share/qutebrowser/userscripts/tabs
new file mode 100755
index 0000000..7f9e226
--- /dev/null
+++ b/qutebrowser/.local/share/qutebrowser/userscripts/tabs
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+# List of tabs
+tabs=$(i3-msg -t get_tree | grep -o '"window":[0-9]*[^{]*{[^}]*qutebrowser[^}]*}')
+
+if [ -n "$1" ]
+then
+ selected_id=$(echo "$tabs" | grep "$@" | sed 's/^.*window":\([0-9]*\).*$/\1/')
+ i3-msg "[id=$selected_id] focus" > /dev/null 2>&1
+ exit;
+fi
+
+# Sanitized List of tabs
+echo "$tabs" | sed 's/^.*title":"\(.*\) - qutebrowser.*/\1/g'