diff --git a/blocks.def/mail_button.sh b/blocks.def/mail_button.sh index 1e2fd4e..e758b44 100755 --- a/blocks.def/mail_button.sh +++ b/blocks.def/mail_button.sh @@ -7,3 +7,5 @@ case "$1" in esac sigdwmblocks 3 +/.$HOME/mailCheck > /dev/null +sigdwmblocks 3 diff --git a/blocks.def/weather.sh b/blocks.def/weather.sh new file mode 100755 index 0000000..8ad94be --- /dev/null +++ b/blocks.def/weather.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +#TEMP=$(curl -s "wttr.in/Argentina?format=%c%t\n" | sed 's/+//') +#TEMP=$(curl -s "wttr.in/Argentina?format=%c%t\n") +TEMP=$(curl -s "wttr.in/BuenosAires?format=%c+%t\n") +# Corto algunos caracteres pues se imprime un caracter inválido entre medio. +# Es algún tema de los unicode. En terminal se imprime bien... +#TEMP_ICON=$(echo -n $TEMP | cut -b 1-3) +#TEMP_ICON=$(echo -n $TEMP | cut -b 1-4) +TEMP_ICON=$(echo -n $TEMP | cut -d+ -f1) +#TEMP=$(echo -n $TEMP | cut -b 8-) +TEMP_TEMP=$(echo -n $TEMP | cut -d+ -f2) + +ICON_LEN=$(printf $TEMP_ICON | wc -c) +ICON_VAR=$(($ICON_LEN-3)) +if [ $ICON_LEN -gt 4 ]; then + TEMP_ICON=$(echo -n $TEMP | cut -b 1-$ICON_VAR) + printf "%s %s" "$TEMP_ICON" "$TEMP_TEMP" + #printf "%s %s •" "$TEMP_ICON" "$TEMP_TEMP" +else + printf "%s%s" "$TEMP_ICON" "$TEMP_TEMP" +fi + +#perl -CO -E "say "\N{$TEMP_ICON}"" + +# Otra forma de bypassear el feof y que se imprima bien es haciendo un grep: +#printf $TEMP_ICON | grep -P "[\x{fe0f}]" diff --git a/blocks.def/weather_button.sh b/blocks.def/weather_button.sh new file mode 100755 index 0000000..763409e --- /dev/null +++ b/blocks.def/weather_button.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in + 1) "$TERMINAL" -e "htop" ;; + 2) "$TERMINAL" -e "bashmount" ;; + 3) psensor ;; +esac diff --git a/config.def.h b/config.def.h index c98c51a..c8dc45a 100644 --- a/config.def.h +++ b/config.def.h @@ -18,7 +18,7 @@ /* delimiter specified as an array of characters <<<<<<< HEAD * (don't remove DELIMITERENDCHAR at the end) */ -static const char delimiter[] = { ' ', ' ', DELIMITERENDCHAR }; +static const char delimiter[] = { ' ', '|', ' ', DELIMITERENDCHAR }; #include "block.h" @@ -45,6 +45,7 @@ static const char delimiter[] = { ' ', ' ', DELIMITERENDCHAR }; static Block blocks[] = { /* pathu pathc interval signal */ { PATH("time.sh"), PATH("time_button.sh"), 1, 1}, + { PATH("weather.sh"), PATH("weather_button.sh"), 900, 5}, { PATH("volume.sh"), PATH("volume_button.sh"), 0, 2}, { PATH("mail.sh"), PATH("mail_button.sh"), 0, 3}, { PATH("cpu_temp.sh"), PATH("cpu_temp_button.sh"), 15, 4},