/waybar-openweathermap

IP-based weather info widget for Waybar, from OpenWeatherMap.org. Use at own risk!

Primary LanguagePythonMIT LicenseMIT

IP-location Waybar weather plugin

This plugin does not use the One Call API from OpenWeatherMap.org. You don't need to have an active subscription, and with normal usage you should never go over the free limit of 1000 request per day. Instead, you need to obtain a free API-key from OpenWeatherMap.org My refresh setting for the waybar plugin is 600s.

set your APIKEY and preferences

In your ~/.bashrc add the following definition and place your APIKEY in there

    # waybar weather settings:
    export WAYBAR_WEATHER_APIKEY="<YOUR OpenWeatherMap API KEY>"                                    # Get one from their website
    export WAYBAR_WEATHER_DEF_POSTAL=<YOUR default zip code>                                        # For when you want another place as fallback
    export WAYBAR_WEATHER_UNITS="metric"                                                            # General units (metric[°C and m/s] / imperial[°F and mph] / metric_simple[° and m/s] / standard[K and m/sec])
    export WAYBAR_WEATHER_ICON_UNITS="metric_simple"                                                # What appears in your waybar (not the tooltip)

I recommend to set your settings in a sort of "start-script" for both them and waybar. This way you can make sure that they are loaded in the correct place at the correct time (or just do whatever works for you). I use a .sh file in the following format:

    # waybar weather settings:
    export WAYBAR_WEATHER_APIKEY="<YOUR OpenWeatherMap API KEY>"                                    
    export WAYBAR_WEATHER_DEF_POSTAL=<YOUR default zip code>                                       
    export WAYBAR_WEATHER_UNITS="metric"
    export WAYBAR_WEATHER_ICON_UNITS="metric_simple"

    exec waybar

Which I load in my hyprland config in two ways:

    exec-once = /home/<username>/.config/waybar/<...>/<name>.sh
    ...                           
    bind = $mainMod, W, exec, killall waybar; /home/<username>/.config/waybar/<...>/<name>.sh

If you find this unnecessary, great. At least this will help my future self then.