2023-04-12 12:21:46 +00:00
|
|
|
if [ x"$@" = x"exit" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2023-04-10 15:54:39 +00:00
|
|
|
|
2023-04-12 12:21:46 +00:00
|
|
|
case $ROFI_RETV in
|
|
|
|
0)
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
val=${@%%.*}
|
|
|
|
res=$(echo $ROFI_DATA | jq -r ".[$val]" )
|
|
|
|
coproc ( librewolf --new-tab $res > /dev/null 2>&1 )
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
ddgrout=$(ddgr --json --num=25 "$@")
|
2023-04-10 15:54:39 +00:00
|
|
|
|
2023-04-12 12:21:46 +00:00
|
|
|
for i in $(echo $ddgrout | jq -r 'keys | @sh'); do
|
|
|
|
title=$(echo $ddgrout | jq -r .[$i].title)
|
|
|
|
url=$(echo $ddgrout | jq -r .[$i].url)
|
|
|
|
echo "$i. $title ($url)"
|
|
|
|
done
|
2023-04-10 15:54:39 +00:00
|
|
|
|
2023-04-12 12:21:46 +00:00
|
|
|
echo -e "\0data\x1f$(echo $ddgrout | jq -r .[].url | jq -sRc '. | split("\n") | [ .[] | select(length > 0) ]')"
|
|
|
|
;;
|
|
|
|
esac
|