Made the waybar a sidebar
This commit is contained in:
parent
75f6e5bb47
commit
6980360fe4
10 changed files with 121 additions and 50 deletions
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# weather info from wttr. https://github.com/chubin/wttr.in
|
||||
# Remember to add city
|
||||
# Remember to add city
|
||||
|
||||
city=
|
||||
cachedir=~/.cache/rbn
|
||||
cachefile=${0##*/}-$1
|
||||
|
||||
if [ ! -d $cachedir ]; then
|
||||
mkdir -p $cachedir
|
||||
mkdir -p $cachedir
|
||||
fi
|
||||
|
||||
if [ ! -f $cachedir/$cachefile ]; then
|
||||
touch $cachedir/$cachefile
|
||||
touch $cachedir/$cachefile
|
||||
fi
|
||||
|
||||
# Save current IFS
|
||||
|
|
@ -22,10 +22,10 @@ IFS=$'\n'
|
|||
|
||||
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
|
||||
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
|
||||
data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1))
|
||||
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
|
||||
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
|
||||
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
|
||||
data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1))
|
||||
echo ${data[0]} | cut -f1 -d, >$cachedir/$cachefile
|
||||
echo ${data[1]} | sed -E 's/^.{15}//' >>$cachedir/$cachefile
|
||||
echo ${data[2]} | sed -E 's/^.{15}//' >>$cachedir/$cachefile
|
||||
fi
|
||||
|
||||
weather=($(cat $cachedir/$cachefile))
|
||||
|
|
@ -40,42 +40,42 @@ temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g')
|
|||
# https://fontawesome.com/icons?s=solid&c=weather
|
||||
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
|
||||
"clear" | "sunny")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"partly cloudy")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"cloudy")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"overcast")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"fog" | "freezing fog")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "mist" | "rain")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
|
||||
condition=""
|
||||
;;
|
||||
condition=""
|
||||
;;
|
||||
*)
|
||||
condition=""
|
||||
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
|
||||
;;
|
||||
condition=""
|
||||
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
|
||||
;;
|
||||
esac
|
||||
|
||||
#echo $temp $condition
|
||||
|
|
@ -84,4 +84,5 @@ echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \
|
|||
|
||||
cached_weather=" $temperature \n$condition ${weather[1]}"
|
||||
|
||||
echo -e $cached_weather > ~/.cache/.weather_cache
|
||||
echo -e $cached_weather >~/.cache/.weather_cache
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue