#!/bin/sh -e FXDE_DIR=/home/midfavila/.config/fxde tme() #Display current time in 24h notation { date|cut -f4 -d ' '|\ sed -ne 's/\([0-9][0-9]*\):\([0-9][0-9]*\)/\1\2/p'|cut -d ':' -f 1 } pwr() #Display current battery capacity and whether we're discharging or not. { x=$(cat /sys/class/power_supply/BAT1/status) if [ "${x}" = "Discharging" ] then printf "--%s%%" "$(cat /sys/class/power_supply/BAT1/capacity)" else printf "++%s%%" "$(cat /sys/class/power_supply/BAT1/capacity)" fi } wlip() #Acquire the IP of our current WLAN connection { x=$(ifconfig eno1|sed -ne 's/.*addr:\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p') 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 } while true;do printf "%%{l}[ %s | %s | %s | %s ]\n" "$(tme)" "$(pwr)" "$(wlip)" "$(tmp)";sleep 1;done