conky upd

This commit is contained in:
Daniel Napora 2025-01-11 00:57:35 +01:00
parent dcee065c37
commit 4ded5ac5a2
2 changed files with 40 additions and 9 deletions

View File

@ -117,7 +117,7 @@ case "$LANG" in
RUNNING_CONKIES="Uruchomione Conky"
STOP_ALL="Zatrzymaj wszystkie"
MORECONKIES="Więcej Conky..."
CLICKTOSTART="Kliknij aby uruchomić"
CLICKTOSTART="<b>Uruchom</b> więcej Conky..."
STARTALL="Uruchom wszystkie"
RESET="Resetuj"
RESETALL="Resetuj wszystkie"
@ -175,7 +175,7 @@ case "$LANG" in
RUNNING_CONKIES="Running Conkys"
STOP_ALL="Stop All"
MORECONKIES="More Conkies Available"
CLICKTOSTART="...click to start"
CLICKTOSTART="<b>Start</b> more Conkies..."
STARTALL="Start all"
RESET="Reset"
RESETALL="Reset all to defaults"
@ -290,6 +290,8 @@ if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then
else # too many conkies not started -> show them in submenu
out+=("$CLICKTOSTART (${#notstarted[@]}),^checkout(nstarted)")
out2+=("^tag(nstarted)")
out2+=("^sep($CLICKTOSTART)")
for c in ${notstarted[@]};do
filename=${c##*/}
name=${filename%%_mb*}

View File

@ -1,23 +1,52 @@
#!/bin/bash
DIR="$HOME/.config/quoter"
mkdir -p "$DIR"
CNF_FILE="$DIR/quoter.cfg"
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}
quote_fontsize=12
author_fontsize=10
font_name="Ubuntu"
EOF
fi
source <(grep = $CNF_FILE)
qfsize=${quote_fontsize:-12}
afsize=${author_fontsize:-10}
fontname=${font_name:-"Source Code Pro"}
quotes=${quotes_file:-"/usr/share/mabox/quotes.txt"}
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
printf "\${font Droid Sans:size=$qfsize}\${color}"
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
#QUOTE="Kto to jest Hiszpania? i dlaczego był Hitler?"
#AUTOR="Nieznany Zenon"
printf "\${font ${fontname}:size=$qfsize}\${color}"
echo ${QUOTE} | fmt -80
printf "\${font Droid Sans:size=$afsize}\${alignr}\${color0}"
printf "\${font ${fontname}:size=$afsize}\${alignr}\${color0}"
echo "${AUTOR}"
}
case "$1" in
-n) notify;;
*) conky;;
esac