2021-06-29 23:50:24 -04:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
FXDE_DIR=/home/midfavila/.config/fxde
|
|
|
|
|
|
|
|
tme() #Display current time in 24h notation
|
|
|
|
{
|
2021-07-05 23:38:36 -04:00
|
|
|
date|sed -ne 's/ */ /gp'|cut -d ' ' -f4|sed -ne 's/\([0-9][0-9]\):\([0-9][0-9]\).*/\1\2/p'
|
2021-06-29 23:50:24 -04:00
|
|
|
}
|
2021-07-05 23:17:38 -04:00
|
|
|
|
2021-06-29 23:50:24 -04:00
|
|
|
pwr() #Display current battery capacity and whether we're discharging or not.
|
|
|
|
{
|
|
|
|
x=$(cat /sys/class/power_supply/BAT1/status)
|
|
|
|
if [ "${x}" = "Discharging" ]
|
2021-07-05 22:18:19 -04:00
|
|
|
then printf "%s%%--" "$(cat /sys/class/power_supply/BAT1/capacity)"
|
|
|
|
else printf "%s%%++" "$(cat /sys/class/power_supply/BAT1/capacity)"
|
2021-06-29 23:50:24 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-07-05 23:17:38 -04:00
|
|
|
ip() #Acquire the IP of our current connection. This is awful. I'm so sorry.
|
2021-06-29 23:50:24 -04:00
|
|
|
{
|
2021-07-05 23:17:38 -04:00
|
|
|
x=$(ifconfig wlp2s0|sed -ne 's/.*addr:\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p')
|
2021-06-29 23:50:24 -04:00
|
|
|
if [ "${x}" ]
|
|
|
|
then printf "%s" "${x}"
|
|
|
|
else printf "N/A"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp() #Acquire ambient temperature from wttr.in every ival seconds
|
|
|
|
{
|
|
|
|
ival=120 #How often do we check?
|
|
|
|
|
|
|
|
if [ "${ival}" = $((ival-($(date|cut -d ':' -f 2)*60)%ival)) ] && \
|
|
|
|
[ ! -e "${FXDE_DIR}/fxde-core/info/timepiece" ]
|
|
|
|
then curl -s http://wttr.in/?format=3|\
|
|
|
|
sed -ne 's/.*\(.[0-9][0-9]*.C\)/\1/p' > "${FXDE_DIR}/fxde-core/info/temp"
|
|
|
|
touch "${FXDE_DIR}/fxde-core/info/timepiece"
|
|
|
|
elif [ -e "${FXDE_DIR}/fxde-core/info/timepiece" ] && \
|
|
|
|
[ "${ival}" != $((ival-($(date|cut -d ':' -f 2)*60)%ival)) ]
|
|
|
|
then rm "${FXDE_DIR}/fxde-core/info/timepiece"
|
|
|
|
else cat "${FXDE_DIR}/fxde-core/info/temp"
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-07-05 23:17:38 -04:00
|
|
|
while true;do printf "%%{l}[ %s | %s | %s | %s ]\n" "$(tme)" "$(pwr)" "$(ip)" "$(tmp)";sleep 1;done
|