summaryrefslogtreecommitdiff
path: root/dot-config/rofi/scripts/sgpt
blob: abd4e165858822ce1c3823ff1f60a4efaaa6702e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

DIR="$HOME/.config/rofi"
RASI="$DIR/sgpt.rasi"

INPUT=$(rofi -dmenu -p "" -theme ${RASI})
if [[ -z $INPUT ]]; then
    exit 1
fi

zenity --progress --text="Waiting for an answer" --pulsate &

if [[ $? -eq 1 ]]; then
    exit 1
fi

PID=$!

ANSWER=$(sgpt "$INPUT" --role general)
kill $PID
zenity --info --text="$ANSWER"