项目作者: kamek-pf

项目描述 :
A weather forecast module for Polybar
高级语言: Rust
项目地址: git://github.com/kamek-pf/polybar-forecast.git
创建时间: 2018-01-02T22:17:31Z
项目社区:https://github.com/kamek-pf/polybar-forecast

开源协议:

下载


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.

  1. # Register at https://openweathermap.org to get your API key
  2. # If you don't want to write your key here, you can delete this line and use the OWM_API_KEY environment variable instead
  3. api_key = "YOUR_API_KEY"
  4. # This is for Montreal, find your city at https://openweathermap.org
  5. # The id will be the last part of the URL
  6. city_id = "6077243"
  7. # Output format, using Handlebars syntax, meaning variables should be used like {{ this }}
  8. # Available tokens are:
  9. # - temp_celcius
  10. # - temp_kelvin
  11. # - temp_fahrenheit
  12. # - temp_icon
  13. # - trend
  14. # - forecast_celcius
  15. # - forecast_kelvin
  16. # - forecast_fahrenheit
  17. # - forecast_icon
  18. 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:

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

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

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

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