Add weather to the bar
This commit is contained in:
parent
faf269f042
commit
e71292029c
3 changed files with 47 additions and 24 deletions
|
@ -12,8 +12,19 @@ interval = 60
|
|||
format = "%R %a %d.%m"
|
||||
|
||||
[[block]]
|
||||
block = "networkmanager"
|
||||
primary_only = true
|
||||
block = "custom"
|
||||
command = ''' /home/cyryl/dev/dotfiles/nixos/i3/openweathermap-fullfeatured.sh '''
|
||||
interval = 600
|
||||
|
||||
[[block]]
|
||||
block = "net"
|
||||
device = "wlp3s0"
|
||||
ssid = true
|
||||
signal_strength = true
|
||||
speed_up = false
|
||||
speed_down = false
|
||||
hide_missing = true
|
||||
hide_inactive = true
|
||||
|
||||
[[block]]
|
||||
block = "cpu"
|
||||
|
@ -44,6 +55,14 @@ alert = 10.0
|
|||
[[block]]
|
||||
block = "sound"
|
||||
|
||||
[[block]]
|
||||
block = "backlight"
|
||||
|
||||
[[block]]
|
||||
block = "kdeconnect"
|
||||
format = "{name}"
|
||||
format_disconnected = ""
|
||||
|
||||
[[block]]
|
||||
block = "bluetooth"
|
||||
mac = "28:11:A5:E1:3C:57"
|
||||
|
|
|
@ -30,7 +30,7 @@ in
|
|||
bars = [
|
||||
{
|
||||
position = "top";
|
||||
colors.background= "#002b36";
|
||||
colors.background = "#002b36";
|
||||
fonts = [ "Fira Code Nerd Font 10" ];
|
||||
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.xdg.configHome}/i3/status.toml";
|
||||
trayOutput = "primary";
|
||||
|
|
|
@ -18,23 +18,25 @@ UNAME=`which uname`
|
|||
|
||||
get_icon() {
|
||||
case $1 in
|
||||
01d) icon="";;
|
||||
01n) icon="";;
|
||||
02d) icon="";;
|
||||
02n) icon="";;
|
||||
03*) icon="";;
|
||||
04*) icon="";;
|
||||
09d) icon="";;
|
||||
09n) icon="";;
|
||||
10d) icon="";;
|
||||
10n) icon="";;
|
||||
11d) icon="";;
|
||||
11n) icon="";;
|
||||
13d) icon="";;
|
||||
13n) icon="";;
|
||||
50d) icon="";;
|
||||
50n) icon="";;
|
||||
*) icon="";
|
||||
01d) icon="";;
|
||||
01n) icon="";;
|
||||
02d) icon="";;
|
||||
02n) icon="";;
|
||||
03d) icon="";;
|
||||
03n) icon="";;
|
||||
04d) icon="";;
|
||||
04n) icon="";;
|
||||
09d) icon="";;
|
||||
09n) icon="";;
|
||||
10d) icon="";;
|
||||
10n) icon="";;
|
||||
11d) icon="";;
|
||||
11n) icon="";;
|
||||
13d) icon="";;
|
||||
13n) icon="";;
|
||||
50d) icon="";;
|
||||
50n) icon="";;
|
||||
*) icon="";
|
||||
esac
|
||||
|
||||
echo $icon
|
||||
|
@ -74,19 +76,21 @@ fi
|
|||
|
||||
if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||
current_temp=$(echo "$current" | $JQ ".main.temp" | $CUT -d "." -f 1)
|
||||
current_feels=$(echo "$current" | $JQ ".main.feels_like" | $CUT -d "." -f 1)
|
||||
current_icon=$(echo "$current" | $JQ -r ".weather[0].icon")
|
||||
|
||||
forecast_temp=$(echo "$forecast" | $JQ ".list[].main.temp" | $CUT -d "." -f 1)
|
||||
forecast_feels=$(echo "$forecast" | $JQ ".list[].main.feels_like" | $CUT -d "." -f 1)
|
||||
forecast_icon=$(echo "$forecast" | $JQ -r ".list[].weather[0].icon")
|
||||
|
||||
|
||||
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
||||
trend=""
|
||||
trend=""
|
||||
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
||||
trend=""
|
||||
trend=""
|
||||
else
|
||||
trend=""
|
||||
trend=""
|
||||
fi
|
||||
|
||||
echo "$(get_icon "$current_icon") $current_temp$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp$SYMBOL"
|
||||
echo "$(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
|
||||
fi
|
Loading…
Reference in a new issue