mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-05 23:26:23 +01:00
get searchwolf running
This commit is contained in:
parent
ceccab3cb9
commit
6069dd0b2b
|
@ -1,2 +1,2 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
pkgs.writeShellScriptBin "searchwolf" builtins.readFile ./searchwolf.sh
|
pkgs.writeShellScriptBin "searchwolf" (builtins.readFile ./searchwolf.sh)
|
||||||
|
|
47
scripts/desktop/searchwolf.sh
Normal file → Executable file
47
scripts/desktop/searchwolf.sh
Normal file → Executable file
|
@ -1,28 +1,25 @@
|
||||||
|
if [ x"$@" = x"exit" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "retv $ROFI_RETV"
|
case $ROFI_RETV in
|
||||||
if [ x"$@" = x"exit" ]; then
|
0)
|
||||||
exit 0
|
;;
|
||||||
fi
|
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 "$@")
|
||||||
|
|
||||||
case $ROFI_RETV in
|
for i in $(echo $ddgrout | jq -r 'keys | @sh'); do
|
||||||
0)
|
title=$(echo $ddgrout | jq -r .[$i].title)
|
||||||
;;
|
url=$(echo $ddgrout | jq -r .[$i].url)
|
||||||
1)
|
echo "$i. $title ($url)"
|
||||||
if [ $ROFI_DATA = x"" ]; then
|
done
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
coproc ( librewolf --new-tab "$(echo $ROFI_DATA | jq -r.[${@%%.*}])" > /dev/null 2>&1 )
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
ddgrout=$(ddgr --json --num=25 "$@")
|
|
||||||
|
|
||||||
for i in $(echo $ddgrout | jq -r 'keys | @sh'); do
|
echo -e "\0data\x1f$(echo $ddgrout | jq -r .[].url | jq -sRc '. | split("\n") | [ .[] | select(length > 0) ]')"
|
||||||
title=$(echo $ddgrout | jq -r .[$i].title)
|
;;
|
||||||
url=$(echo $ddgrout | jq -r .[$i].url)
|
esac
|
||||||
echo "$i. $title ($url)"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "\0data\x1f$(echo $ddgrout | jq -r .[].url | jq -sRc '. | split("\n") | [ .[] | select(length > 0) ]')"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
Loading…
Reference in a new issue