Skip to content

PluginWeather

Fábio Luciano edited this page Dec 25, 2025 · 4 revisions

Plugin: weather

Display current weather conditions from wttr.in with customizable location, units, and format.

Screenshot

☀️ 15°C            # Dynamic icon mode (default)
󰖐 15°C             # Static icon mode
☀️ 15°C Clear      # With condition text
🌧️ 8°C ↗5km/h     # Temperature with wind
❄️ -5°C 65%        # Negative temperature with humidity

Requirements

Property Value
Platform macOS, Linux, BSD, WSL
Dependencies curl
Content Type dynamic
Presence conditional

Installation

# macOS (Homebrew)
brew install curl

# Linux (usually pre-installed)
sudo apt install curl      # Debian/Ubuntu
sudo dnf install curl      # Fedora
sudo pacman -S curl        # Arch

Quick Start

# Enable plugin (auto-detects location)
set -g @powerkit_plugins "weather"

Configuration Example

# Enable plugin
set -g @powerkit_plugins "weather"

# Location (empty for auto-detect, or city name)
set -g @powerkit_plugin_weather_location ""

# Units: m (metric/Celsius), u (US/Fahrenheit), M (SI/Kelvin)
set -g @powerkit_plugin_weather_units "m"

# Format string (%t=temp, %c=condition icon, %C=condition text, %w=wind, %h=humidity)
set -g @powerkit_plugin_weather_format "%t"

# Language code (optional)
set -g @powerkit_plugin_weather_language ""

# Hide + sign on positive temperatures (default: true)
set -g @powerkit_plugin_weather_hide_plus_sign "true"

# Icon (used when icon_mode is static)
set -g @powerkit_plugin_weather_icon "󰖐"

# Icon mode: static (use icon option) or dynamic (use weather condition symbol from API)
set -g @powerkit_plugin_weather_icon_mode "dynamic"

# Cache duration (seconds) - weather updates slowly
set -g @powerkit_plugin_weather_cache_ttl "1800"

# Only show on threshold (not applicable for weather)
set -g @powerkit_plugin_weather_show_only_on_threshold "false"

Options Reference

Option Type Default Description
@powerkit_plugin_weather_location string `` Location (city name, empty for auto-detect)
@powerkit_plugin_weather_units string m Units: m (metric/°C), u (US/°F), M (SI/K)
@powerkit_plugin_weather_format string %t Format string (see Format Codes below)
@powerkit_plugin_weather_language string `` Language code (pt, es, fr, de, etc.)
@powerkit_plugin_weather_hide_plus_sign bool true Hide + sign on positive temperatures
@powerkit_plugin_weather_icon icon 󰖐 Plugin icon (used when icon_mode is static)
@powerkit_plugin_weather_icon_mode string dynamic Icon mode: static or dynamic (API symbol)
@powerkit_plugin_weather_cache_ttl number 1800 Cache duration in seconds (30 min)
@powerkit_plugin_weather_show_only_on_threshold bool false Only show when threshold exceeded (N/A)

Icon Modes

Mode Description Example
dynamic Uses weather condition symbol from API (☀️, 🌧️, ❄️, etc.) ☀️ 15°C
static Uses the configured icon option 󰖐 15°C

States

State Condition Visibility
active Weather data fetched successfully Visible
inactive Cannot fetch weather (network/API error) Hidden

Health Levels

Level Condition Color
ok Weather data available Green

Context Values

Context Description
available Weather data successfully retrieved
unavailable Network error or API unavailable

Format Codes

wttr.in supports various format codes for customizing weather display:

Code Description Example
%t Temperature 15°C
%c Weather condition icon ☀️ or 🌧️
%C Weather condition text Clear, Cloudy
%w Wind speed and direction ↗5km/h
%h Humidity 65%
%p Precipitation (mm/24h) 0.1mm
%P Pressure (hPa) 1015hPa
%u UV index 3
%m Moon phase 🌓

Combining Format Codes

# Temperature only
set -g @powerkit_plugin_weather_format "%t"
# Output: 15°C

# Temperature with condition
set -g @powerkit_plugin_weather_format "%c %t"
# Output: ☀️ 15°C

# Full weather info
set -g @powerkit_plugin_weather_format "%c %t %C"
# Output: ☀️ 15°C Clear

# Temperature with wind and humidity
set -g @powerkit_plugin_weather_format "%t %w %h"
# Output: 15°C ↗5km/h 65%

Unit Systems

Unit Code Temperature Wind Precipitation
Metric m Celsius (°C) km/h mm
US/Imperial u Fahrenheit (°F) mph in
SI M Kelvin (K) m/s mm

Language Support

wttr.in supports multiple languages for condition text:

Language Code Example
English `` Clear
Portuguese pt Limpo
Spanish es Despejado
French fr Dégagé
German de Klar
Russian ru Ясно
Italian it Sereno
Chinese zh 晴朗

For full list, see wttr.in language support.

Examples

Minimal Configuration (Auto-Detect Location)

set -g @powerkit_plugins "weather"

Output: ☀️ 15°C

Specific Location

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_location "London"

Output: ☀️ 12°C

Fahrenheit Units

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_units "u"

Output: ☀️ 59°F

Static Icon Mode

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_icon_mode "static"
set -g @powerkit_plugin_weather_icon "󰖐"

Output: 󰖐 15°C

Show Plus Sign on Positive Temperatures

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_hide_plus_sign "false"

Output: ☀️ +15°C

With Weather Condition Text

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_format "%t %C"

Output: ☀️ 15°C Clear

Full Weather Display

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_format "%t %C"

Output: ☀️ 15°C Clear

With Wind and Humidity

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_format "%t %w %h"

Output: ☀️ 15°C ↗5km/h 65%

Portuguese Language

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_format "%t %C"
set -g @powerkit_plugin_weather_language "pt"

Output: ☀️ 15°C Limpo

Frequent Updates

set -g @powerkit_plugins "weather"
set -g @powerkit_plugin_weather_cache_ttl "900"  # 15 minutes

Location Formats

The location option accepts various formats:

Format Example
City name London
City, Country Paris,France
Airport code LAX
Coordinates ~37.7749,-122.4194
Domain/IP @github.com

Troubleshooting

Weather Not Showing

  1. Check network connectivity:

    curl -I https://wttr.in
  2. Verify curl is installed:

    which curl
    curl --version
  3. Test wttr.in manually:

    curl "https://wttr.in?format=%t"

Wrong Location Detected

Auto-detection uses your IP address. To force a specific location:

set -g @powerkit_plugin_weather_location "YourCity"

Slow Loading

Weather API can be slow. Increase cache duration:

set -g @powerkit_plugin_weather_cache_ttl "3600"  # 1 hour

Special Characters Not Displaying

Ensure your terminal supports Unicode and has proper font:

  • Use a Nerd Font or font with emoji support
  • Check terminal encoding is UTF-8

API Rate Limiting

wttr.in has rate limits. If you hit limits:

  • Increase cache_ttl to reduce requests
  • Avoid refreshing tmux status too frequently

Timeout Errors

Connection timeout is 3 seconds, max time is 6 seconds. If your connection is slow:

  • Increase cache TTL to reduce API calls
  • Check your internet connection stability

Data Source

This plugin uses the wttr.in weather service:

  • Free and open source
  • No API key required
  • Data from multiple weather services
  • Supports worldwide locations

Related Plugins

Clone this wiki locally