[vimb] Moving from qb to vimb for browsing

This commit is contained in:
2021-02-14 23:32:05 -05:00
parent 2814cccf84
commit 864ce914e4
5 changed files with 44 additions and 23 deletions

View File

@ -43,6 +43,20 @@ gen_list() {
done done
} }
urlencode() {
# urlencode <string>
local LANG=C
local length="${#1}"
for ((i = 0; i < length; i++)); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
done
}
main() { main() {
# Pass the list to rofi # Pass the list to rofi
platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > ") platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > ")
@ -51,8 +65,8 @@ main() {
query=$( (echo) | rofi -dmenu -matching fuzzy -location 0 -p "Query > ") query=$( (echo) | rofi -dmenu -matching fuzzy -location 0 -p "Query > ")
if [[ -n "$query" ]]; then if [[ -n "$query" ]]; then
url=${URLS[$platform]}$query URL=${URLS[$platform]}$(urlencode "$query")
/home/powellc/.asdf/shims/qutebrowser ":open -w $url" /usr/local/bin/vimb $URL
else else
exit exit
fi fi

View File

@ -5,23 +5,21 @@ OPTS=-u "$AGENT" -z 1.1
#OPTS="-z 1.5" #OPTS="-z 1.5"
HISTORY=~/var/rofi-www-history HISTORY=~/var/rofi-www-history
if [ "$1" = "" ] if [ "$1" = "" ]; then
then URL=$(cat $HISTORY | rofi -hide-scrollbar -dmenu -p "URL: ")
URL=`cat $HISTORY | rofi -hide-scrollbar -dmenu -p "URL: "` echo "$URL" | grep -e ^http || CLIP=https://$CLIP
echo "$URL" | grep -e ^http || CLIP=https://$CLIP echo "$URL" >>$HISTORY
echo "$URL" >> $HISTORY
else else
URL=$@ URL=$@
echo "$@" | grep -e ^http && CLIP=https://$CLIP echo "$@" | grep -e ^http && CLIP=https://$CLIP
echo "$@" >> $HISTORY echo "$@" >>$HISTORY
fi fi
TMP=`tempfile` TMP=$(tempfile)
cat $HISTORY | sort | uniq >> $TMP && mv $TMP $HISTORY cat $HISTORY | sort | uniq >>$TMP && mv $TMP $HISTORY
rm -f $TMP rm -f $TMP
if [ "$URL" = "" ] if [ "$URL" = "" ]; then
then exit 0
exit 0
fi fi
/home/powellc/.asdf/shims/qutebrowser ":open -w $URL" /usr/local/bin/vimb "$URL"

View File

@ -12,8 +12,13 @@ set sans-serif-font=Overpass
set serif-font=Source Serif set serif-font=Source Serif
set font-size=16 set font-size=16
set monospace-font-size=14 set monospace-font-size=14
set default-zoom=110 set default-zoom=120
set hint-keys=abcdefghijklmnopqrstuvwy set hint-keys=abcdefghijklmnopqrstuvwy
set history-max-items=99999
set smooth-scrolling=true
set status-bar=false
set webinspector=true
set caret=true
shortcut-add s=https://search.unbl.ink/search?q=$0 shortcut-add s=https://search.unbl.ink/search?q=$0
shortcut-default s shortcut-default s

View File

@ -0,0 +1,4 @@
._hintLabel {
text-transform: uppercase !important;
font-size: 1em;
}

View File

@ -7,8 +7,8 @@ application/pdf=org.pwmt.zathura-pdf-mupdf.desktop
text/html=emacs.desktop text/html=emacs.desktop
application/python=emacs.desktop application/python=emacs.desktop
application/javascript=emacs.desktop application/javascript=emacs.desktop
x-www-browser=qutebrowser.desktop x-www-browser=vimb.desktop
x-scheme-handler/http=qutebrowser.desktop x-scheme-handler/http=vimb.desktop
x-scheme-handler/https=qutebrowser.desktop x-scheme-handler/https=vimb.desktop
x-scheme-handler/about=qutebrowser.desktop x-scheme-handler/about=vimb.desktop
x-scheme-handler/unknown=qutebrowser.desktop x-scheme-handler/unknown=vimb.desktop