2022-05-15 14:09:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
DIR="$HOME/.config/quoter"
|
|
|
|
mkdir -p "$DIR"
|
2022-06-02 23:46:52 +02:00
|
|
|
CNF_FILE="$DIR/quoter.cfg"
|
|
|
|
if [ ! -f $CNF_FILE ]; then
|
|
|
|
cat <<EOF > ${CNF_FILE}
|
2022-06-08 21:45:29 +02:00
|
|
|
quote_fontsize=12
|
|
|
|
author_fontsize=10
|
2022-06-02 23:46:52 +02:00
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
source <(grep = $CNF_FILE)
|
2022-06-08 21:45:29 +02:00
|
|
|
qfsize=${quote_fontsize:-12}
|
|
|
|
afsize=${author_fontsize:-10}
|
2022-05-15 14:09:55 +02:00
|
|
|
|
|
|
|
export Q=$(curl -s "http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en" | sed 's|\\||g' )
|
|
|
|
QUOTE=$(echo $Q | jq .quoteText)
|
|
|
|
AUTOR=$(echo $Q | jq .quoteAuthor | tr -d '"')
|
|
|
|
echo "${QUOTE}|${AUTOR}" >> "${DIR}"/forismatic.txt
|
|
|
|
|
2022-06-02 23:46:52 +02:00
|
|
|
printf "\${font Droid Sans:size=$qfsize}\${color}"
|
2022-05-15 14:09:55 +02:00
|
|
|
echo ${QUOTE} | fmt -80
|
2022-06-02 23:46:52 +02:00
|
|
|
printf "\${font Droid Sans:size=$afsize}\${alignr}\${color0}"
|
2022-06-08 21:45:29 +02:00
|
|
|
echo "${AUTOR}"
|