Code Monkey home page Code Monkey logo

polybar-forecast's Introduction

Unmaintained

ntfd is a lightweight replacement with more features, take a look!

Weather forecast for Polybar

This is a simple weather forecast module for Polybar.
The first number is the current temperature and the second one is a 3 hour forecast, the output is fully configurable.

You need Weather Icons and Material Icons for this to work properly.
For Arch users, both are available in the AUR:

Configuration

Look at the example TOML configuration file.

# Register at https://openweathermap.org to get your API key
# If you don't want to write your key here, you can delete this line and use the OWM_API_KEY environment variable instead
api_key = "YOUR_API_KEY"

# This is for Montreal, find your city at https://openweathermap.org
# The id will be the last part of the URL
city_id = "6077243"

# Output format, using Handlebars syntax, meaning variables should be used like {{ this }}
# Available tokens are:
# - temp_celcius
# - temp_kelvin
# - temp_fahrenheit
# - temp_icon
# - trend
# - forecast_celcius
# - forecast_kelvin
# - forecast_fahrenheit
# - forecast_icon
display = "{{ temp_icon }} {{ temp_celcius }}°C {{ trend }} {{ forecast_icon }} {{ forecast_celcius }}°C"

Setup

Grab a pre built binary from the release page (you might need to chmod +x), or run cargo build --release, in which case you'll find the binary at target/release/polybar-forecast.
You can copy the binary anywhere you want, the config files has to placed in either:

  • $HOME/.config/polybar-forecast/config.toml
  • The same directory as the binary

Polybar integration

You can define your new module like this:

[module/weather]
type = custom/script
exec = /path/to/polybar-forecast
exec-if = ping openweathermap.org -c 1
interval = 600
label-font = 3

Don't forget to add Weather Icons to your config or it won't render correctly:

...
font-2 = Weather Icons:size=12;0
...

Then you may add your new weather module on your bar.

polybar-forecast's People

Contributors

jean-santos avatar kamek-pf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.