From 95973d65330ccbefb2e221b7dfe03623254b4842 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 22 May 2020 01:15:13 +0200 Subject: [PATCH] Add more recognizable icons and update only every 6 hours --- custom/segments.zsh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/custom/segments.zsh b/custom/segments.zsh index 9bf2a0a..965ad80 100644 --- a/custom/segments.zsh +++ b/custom/segments.zsh @@ -31,30 +31,30 @@ function prompt_weather() { # Fancy stuff local -A icons local -A colors - icons[c]='' + icons[c]='盛' colors[c]="yellow" - icons[lc]='' + icons[lc]='' colors[lc]="yellow" - icons[hc]='' + icons[hc]='' colors[hc]="cyan" - icons[s]='' - colors[s]="cyan" - icons[lr]='' + icons[s]='🌢' + colors[s]="yellow" + icons[lr]='🌢' colors[lr]="cyan" - icons[hr]='' - colors[hr]="cyan" - icons[t]='' + icons[hr]='' + colors[hr]="blue" + icons[t]='' colors[t]="white" - icons[h]='' - colors[h]="blue" - icons[sl]='' + icons[h]='' + colors[h]="white" + icons[sl]='' colors[sl]="blue" icons[sn]='' colors[sn]="white" if [ ! -v _cprompts_weather ]; then zstat -A stats +mtime -- $tmpfile 2>/dev/null - if [[ $stats[1] < $(($epochtime[1]-360)) ]]; then + if [[ $stats[1] < $(($epochtime[1]-21600)) ]]; then local result=$(curl -sL https://www.metaweather.com/api/location/${_cprompts_weather_loc:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "icon": .weather_state_abbr}') if [ ! -z $result ]; then local ico=$(print $result | jq -r '.icon')