This Polybar plugin uses OpenWeather API to get and display information about the current weather like the temprate and condition. The temprature is shown in numericals while the condition is shown through color and icons.
This module is easily customizable. All you need to do is modify the shell script getweather.sh
.
1 - Get your own openweather api key. If you don’t know how to, refer to this article.
2 - Get the city code of the city whose weather details you want. You can search your city on openweather.org and copying the digits after .../city/
.
3 - Make a plain text file called .env in your home directory.
4 - Put the API key and city code in the text file. eg.
OPEN_WEATHER_API_KEY="yourAPIkey"
OPEN_WEATHER_CITY_ID="yourCityCode"
5 - Make the script executable by chmod + x /path/to/the/script
6 - Put this in your polybar config.ini
[module/weather]
type = custom/script
exec = /path/to/the/script
tail = false
interval = 100
7 - Add the module to your bar’s modules.
You can customize the units by changing the value of UNITS in the script. Possible values are metric, imperial and kelvin.
You can change the icons for the different weather conditions by changing the ICON variable in the script.
You can change the colors for the different weather conditions by changing the ICON_HEX variable in the script.
You can change the conditions of the different icon codes by changing the values of the CONDITION and DAYTIME variables.
If you want to add some features or want to fix a mistake, feel free to open a pull request.