From 4ef38f411ec198328b5c18ba4b56b1499e4bc798 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 7 Jun 2017 13:04:32 +0100 Subject: Add script to facilitate qutebrowser navigation --- .../share/qutebrowser/userscripts/dictionary-search | 2 +- qutebrowser/.local/share/qutebrowser/userscripts/explorer | 15 +++++++++++++++ qutebrowser/.local/share/qutebrowser/userscripts/history | 10 ++++++++++ .../.local/share/qutebrowser/userscripts/quickmarks | 10 ++++++++++ .../.local/share/qutebrowser/userscripts/quickmarks-dmenu | 7 ------- .../.local/share/qutebrowser/userscripts/tab-switch | 6 ------ qutebrowser/.local/share/qutebrowser/userscripts/tabs | 14 ++++++++++++++ 7 files changed, 50 insertions(+), 14 deletions(-) create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/explorer create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/history create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/quickmarks delete mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/quickmarks-dmenu delete mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/tab-switch create mode 100755 qutebrowser/.local/share/qutebrowser/userscripts/tabs (limited to 'qutebrowser/.local/share') 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' -- cgit v1.2.3