TheRepoClub-DotFiles/lemonbar/.local/bin/lemonbar/lemonbar_weather
The-Repo-Club d234b7fe51
Updates
2023-08-19 22:32:45 +01:00

33 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
weather() {
configFile=$HOME/.config/flexiflow/flexiflow_bar/bar_weather.ini
timestamp=$(date +%s)
icon=""
[[ -f $configFile ]] && . $configFile
if [ -z "$LastUsed" ] || [ -z "$Message" ]; then
weather=$(ansiweather | awk '{print $4 $5}')
printf " %s %s \n" "$icon" "$weather"
newtime=$(expr $timestamp + 900)
echo -e "LastUsed=${newtime}\nMessage='${weather}'" >$configFile
else
if [ "$Message" == "weatherdata" ]; then
weather=$(ansiweather | awk '{print $4 $5}')
printf " %s %s \n" "$icon" "$weather"
newtime=$(expr $timestamp + 900)
echo -e "LastUsed=${newtime}\nMessage='${weather}'" >$configFile
else
if [ "$timestamp" -ge "$LastUsed" ]; then
weather=$(ansiweather | awk '{print $4 $5}')
printf " %s %s \n" "$icon" "$weather"
newtime=$(expr $timestamp + 900)
echo -e "LastUsed=${newtime}\nMessage='${weather}'" >$configFile
else
printf " %s %s \n" "$icon" "$Message"
fi
fi
fi
}
weather