mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
24 lines
896 B
Bash
Executable file
24 lines
896 B
Bash
Executable file
#!/bin/dash
|
|
openDetailsAction() {
|
|
echo "Details:surf https://hoogle.haskell.org/?hoogle=$1&scope=package:$2"
|
|
}
|
|
|
|
query=$( echo "h\ng" | rofi -i -theme /home/leon/scripts/rofi-scripts/default_theme.rasi -dmenu )
|
|
selection=$( echo "$query" | awk '{print $1}' )
|
|
input=$( echo "$query" | awk '{print $2}' )
|
|
|
|
case "$selection" in
|
|
"h")
|
|
query=$( echo "$input" | sed 's/ p=.*$//g' )
|
|
package=$( echo "$input" | sed 's/.*p=//g' )
|
|
[ "$package" = "$query" ] && package=""
|
|
|
|
selection=$( hoogle "$query" | rofi -p "select" -i -theme /home/leon/scripts/rofi-scripts/default_theme.rasi -dmenu | sed 's/^\(.*\) :: .*$/\1/' | sed 's/\ /./g' )
|
|
result=$( echo "$selection" | xargs hoogle --info )
|
|
notify-send.sh --icon="dialog-information" --action="$(openDetailsAction "$query" "$package")" "Hoogle" "$result"
|
|
;;
|
|
"g")
|
|
$BROWSER "https://google.de/search?q=$input" &
|
|
;;
|
|
esac
|
|
|