Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Weather does not show temperature #318

Closed
wisscot opened this issue Jan 4, 2025 · 4 comments
Closed

Bug: Weather does not show temperature #318

wisscot opened this issue Jan 4, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@wisscot
Copy link
Contributor

wisscot commented Jan 4, 2025

Describe the bug

When I enable weather, it shows the weather condition (like snow/sunny icon) but not the temperature.

To Reproduce

Steps to reproduce the behavior:

  1. Installed zsh, omz, tmux, tpm and dracula
  2. added plugins to
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'dracula/tmux'
set -g @dracula-plugins "cpu-usage ram-usage weather time"
  1. install plugin and reload tmux config

Expected behavior

Temperature should show up.

Debug

I have added some debug in ~/.tmux/plugins/tmux/scripts/weather.sh

diff --git a/scripts/weather.sh b/scripts/weather.sh
index ce3969c..957c89b 100755
--- a/scripts/weather.sh
+++ b/scripts/weather.sh
@@ -48,10 +48,16 @@ display_weather()
     display_weather='&m' # for metric system
   fi
   weather_information=$(fetch_weather_information $display_weather)
+  echo "Weather Info: $weather_information" >> /tmp/weather-debug.log

   weather_condition=$(echo $weather_information | rev | cut -d ' ' -f2- | rev) # Sunny, Snow, etc
   temperature=$(echo $weather_information | rev | cut -d ' ' -f 1 | rev) # +31°C, -3°F, etc
   unicode=$(forecast_unicode $weather_condition)
+  echo "Condition: $weather_condition, Temperature: $temperature" >> /tmp/weather-debug.log

   # Mac Only variant should be transparent on Linux
   if [[ "${temperature/+/}" == *"===="* ]]; then

and output to /tmp/weather-debug.log

Weather Info: Light snow, mist -3°C
Condition: , Temperature:

Seems the weather info is not parsed correctly

System

  • OS: Ubuntu 20.04.3 LTS
  • Tmux Version: 3.0a
@wisscot wisscot added the bug Something isn't working label Jan 4, 2025
@ethancedwards8
Copy link
Member

I am experiencing this too. I'm guessing the API has changed in some way.

@ethancedwards8
Copy link
Member

Try this? #319

ethancedwards8 added a commit to ethancedwards8/tmux that referenced this issue Jan 4, 2025
For some reason, a " is prepended to the weather. It messed with our
parsing. I fixed this. There is a chance this is a mistake on wttr.in's
part and will be fixed soon?

Fixes: dracula#318

Signed-off-by: Ethan Carter Edwards <[email protected]>
@wisscot
Copy link
Contributor Author

wisscot commented Jan 4, 2025

thanks for the quick reply! I will try that. In the meanwhile, I made a fix too #320

@wisscot
Copy link
Contributor Author

wisscot commented Jan 4, 2025

@ethancedwards8 #319 seems not working for me, the output is

Weather Info: Light snow, mist -7°C
Condition: , Temperature:

The fix #320 works for me, but not sure of the compatibility for various systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants