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"
|
format = "%R %a %d.%m"
|
||||||
|
|
||||||
[[block]]
|
[[block]]
|
||||||
block = "networkmanager"
|
block = "custom"
|
||||||
primary_only = true
|
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]]
|
||||||
block = "cpu"
|
block = "cpu"
|
||||||
|
@ -44,6 +55,14 @@ alert = 10.0
|
||||||
[[block]]
|
[[block]]
|
||||||
block = "sound"
|
block = "sound"
|
||||||
|
|
||||||
|
[[block]]
|
||||||
|
block = "backlight"
|
||||||
|
|
||||||
|
[[block]]
|
||||||
|
block = "kdeconnect"
|
||||||
|
format = "{name}"
|
||||||
|
format_disconnected = ""
|
||||||
|
|
||||||
[[block]]
|
[[block]]
|
||||||
block = "bluetooth"
|
block = "bluetooth"
|
||||||
mac = "28:11:A5:E1:3C:57"
|
mac = "28:11:A5:E1:3C:57"
|
||||||
|
|
|
@ -30,7 +30,7 @@ in
|
||||||
bars = [
|
bars = [
|
||||||
{
|
{
|
||||||
position = "top";
|
position = "top";
|
||||||
colors.background= "#002b36";
|
colors.background = "#002b36";
|
||||||
fonts = [ "Fira Code Nerd Font 10" ];
|
fonts = [ "Fira Code Nerd Font 10" ];
|
||||||
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.xdg.configHome}/i3/status.toml";
|
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.xdg.configHome}/i3/status.toml";
|
||||||
trayOutput = "primary";
|
trayOutput = "primary";
|
||||||
|
|
|
@ -18,23 +18,25 @@ UNAME=`which uname`
|
||||||
|
|
||||||
get_icon() {
|
get_icon() {
|
||||||
case $1 in
|
case $1 in
|
||||||
01d) icon="";;
|
01d) icon="";;
|
||||||
01n) icon="";;
|
01n) icon="";;
|
||||||
02d) icon="";;
|
02d) icon="";;
|
||||||
02n) icon="";;
|
02n) icon="";;
|
||||||
03*) icon="";;
|
03d) icon="";;
|
||||||
04*) icon="";;
|
03n) icon="";;
|
||||||
09d) icon="";;
|
04d) icon="";;
|
||||||
09n) icon="";;
|
04n) icon="";;
|
||||||
10d) icon="";;
|
09d) icon="";;
|
||||||
10n) icon="";;
|
09n) icon="";;
|
||||||
11d) icon="";;
|
10d) icon="";;
|
||||||
11n) icon="";;
|
10n) icon="";;
|
||||||
13d) icon="";;
|
11d) icon="";;
|
||||||
13n) icon="";;
|
11n) icon="";;
|
||||||
50d) icon="";;
|
13d) icon="";;
|
||||||
50n) icon="";;
|
13n) icon="";;
|
||||||
*) icon="";
|
50d) icon="";;
|
||||||
|
50n) icon="";;
|
||||||
|
*) icon="";
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo $icon
|
echo $icon
|
||||||
|
@ -74,19 +76,21 @@ fi
|
||||||
|
|
||||||
if [ -n "$current" ] && [ -n "$forecast" ]; then
|
if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||||
current_temp=$(echo "$current" | $JQ ".main.temp" | $CUT -d "." -f 1)
|
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")
|
current_icon=$(echo "$current" | $JQ -r ".weather[0].icon")
|
||||||
|
|
||||||
forecast_temp=$(echo "$forecast" | $JQ ".list[].main.temp" | $CUT -d "." -f 1)
|
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")
|
forecast_icon=$(echo "$forecast" | $JQ -r ".list[].weather[0].icon")
|
||||||
|
|
||||||
|
|
||||||
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
||||||
trend=""
|
trend=""
|
||||||
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
||||||
trend=""
|
trend=""
|
||||||
else
|
else
|
||||||
trend=""
|
trend=""
|
||||||
fi
|
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
|
fi
|
Loading…
Reference in a new issue