mabox-colorizer/bin/quote.sh

53 lines
1.1 KiB
Bash
Raw Normal View History

2022-05-15 14:09:55 +02:00
#!/bin/bash
2025-01-11 00:57:35 +01:00
2022-05-15 14:09:55 +02:00
DIR="$HOME/.config/quoter"
mkdir -p "$DIR"
2025-01-11 00:57:35 +01:00
CNF_FILE="$DIR/quoter.conf"
notify(){
source <(grep = $CNF_FILE)
quotes=${quotes_file:-"/usr/share/mabox/quotes.txt"}
Q=$(shuf -n 1 "${quotes}")
QUOTE=${Q%|*}
AUTOR=${Q#*|}
notify-send.sh -t 15000 --icon=$HOME/.config/mabox/wpicon.png "${AUTOR}\n" "${QUOTE}" --action="Next:quote.sh -n"
}
conky() {
if [ ! -f $CNF_FILE ]; then
cat <<EOF > ${CNF_FILE}
2022-06-08 21:45:29 +02:00
quote_fontsize=12
author_fontsize=10
2025-01-11 00:57:35 +01:00
font_name="Ubuntu"
EOF
fi
source <(grep = $CNF_FILE)
2022-06-08 21:45:29 +02:00
qfsize=${quote_fontsize:-12}
afsize=${author_fontsize:-10}
2025-01-11 00:57:35 +01:00
fontname=${font_name:-"Source Code Pro"}
quotes=${quotes_file:-"/usr/share/mabox/quotes.txt"}
Q=$(shuf -n 1 "${quotes}")
QUOTE=${Q%|*}
AUTOR=${Q#*|}
#QUOTE=$(crow -b $(echo $Q | jq .quoteText))
#AUTOR=$(echo $Q | jq .quoteAuthor | tr -d '"')
#echo "${QUOTE}|${AUTOR}" >> "${DIR}"/forismatic.txt
2022-05-15 14:09:55 +02:00
2025-01-11 00:57:35 +01:00
#QUOTE="Kto to jest Hiszpania? i dlaczego był Hitler?"
#AUTOR="Nieznany Zenon"
2022-05-15 14:09:55 +02:00
2025-01-11 00:57:35 +01:00
printf "\${font ${fontname}:size=$qfsize}\${color}"
2022-05-15 14:09:55 +02:00
echo ${QUOTE} | fmt -80
2025-01-11 00:57:35 +01:00
printf "\${font ${fontname}:size=$afsize}\${alignr}\${color0}"
2022-06-08 21:45:29 +02:00
echo "${AUTOR}"
2025-01-11 00:57:35 +01:00
}
case "$1" in
-n) notify;;
*) conky;;
esac