[i3] Add better rofi tools to I3

This commit is contained in:
2021-02-04 18:03:59 -05:00
parent dcae1a4f1b
commit 57c16cf9ec
5 changed files with 60 additions and 45 deletions

View File

@ -7,4 +7,4 @@ configuration {
show-icons: true;
combi-modi: "ssh,window,drun";
}
@import "/usr/share/rofi/themes/gruvbox-dark-soft.rasi"
@import "/usr/share/rofi/themes/gruvbox-dark-hard.rasi"

View File

@ -16,7 +16,7 @@ main() {
query=$( rofi -dmenu -matching fuzzy -location 0 -p "Query > " )
if [[ -n "$query" ]]; then
url=$URL$query
xdg-open "$url"
/home/powellc/.asdf/shims/qutebrowser ":open -w $url"
else
exit
fi

View File

@ -22,51 +22,43 @@ declare -A URLS
# https://b-ok.cc/s/?q="
#
URLS=(
["search"]="https://search.unbl.ink/?q="
["google"]="https://www.google.com/search?q="
["ddg"]="https://www.duckduckgo.com/?q="
["amazon"]="https://www.amazon.com/s?k="
["github"]="https://github.com/search?q="
["goodreads"]="https://www.goodreads.com/search?q="
["stackoverflow"]="http://stackoverflow.com/search?q="
["symbolhound"]="http://symbolhound.com/?q="
["searchcode"]="https://searchcode.com/?q="
["imdb"]="http://www.imdb.com/find?ref_=nv_sr_fn&q="
["rottentomatoes"]="https://www.rottentomatoes.com/search/?search="
["invidous"]="https://invidio.us/search?q="
["vimawesome"]="http://vimawesome.com/?q="
["beer"]="https://www.beeradvocate.com/search/?qt=beer&q="
["jira"]="https://15five-dev.atlassian.net/plugins/servlet/mobile#issue/ENG-"
["books"]="http://zlibraryexau2g3p.onion/s/"
["maps"]="https://www.openstreetmap.com/search?query="
["pirate"]="https://proxahoy.link/s/?q="
["books"]="http://b-ok.cc/s/"
["amazon"]="https://www.amazon.com/s?k="
["stackoverflow"]="http://stackoverflow.com/search?q="
["code"]="https://searchcode.com/?q="
["invidous"]="https://invidio.us/search?q="
["beer"]="https://www.beeradvocate.com/search/?qt=beer&q="
["jira"]="https://15five-dev.atlassian.net/browse/ENG-"
["maps"]="https://www.openstreetmap.com/search?query="
["pirate"]="https://thepiratebay.zone/search/"
["search"]="https://search.unbl.ink/?q="
)
# List for rofi
gen_list() {
for i in "${!URLS[@]}"
do
echo "$i"
done
for i in "${!URLS[@]}"; do
echo "$i"
done
}
main() {
# Pass the list to rofi
platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > " )
# Pass the list to rofi
platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > ")
if [[ -n "$platform" ]]; then
query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Query > " )
if [[ -n "$platform" ]]; then
query=$( (echo) | rofi -dmenu -matching fuzzy -location 0 -p "Query > ")
if [[ -n "$query" ]]; then
url=${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
if [[ -n "$query" ]]; then
url=${URLS[$platform]}$query
/home/powellc/.asdf/shims/qutebrowser ":open -w $url"
else
exit
fi
else
exit
fi
else
exit
fi
}
main

27
rofi/.config/rofi/www.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3"
OPTS=-u "$AGENT" -z 1.1
#OPTS="-z 1.5"
HISTORY=~/var/rofi-www-history
if [ "$1" = "" ]
then
URL=`cat $HISTORY | rofi -hide-scrollbar -dmenu -p "URL: "`
echo "$URL" | grep -e ^http || CLIP=https://$CLIP
echo "$URL" >> $HISTORY
else
URL=$@
echo "$@" | grep -e ^http && CLIP=https://$CLIP
echo "$@" >> $HISTORY
fi
TMP=`tempfile`
cat $HISTORY | sort | uniq >> $TMP && mv $TMP $HISTORY
rm -f $TMP
if [ "$URL" = "" ]
then
exit 0
fi
/home/powellc/.asdf/shims/qutebrowser ":open -w $URL"