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

kamek-pf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

polybar-forecast's Issues

OpenWeather Invalid Response

Hi. Thanks for developing this. I've built the binary and put my customized config next to it, but I'm getting the following error:

Forecast unavailable (Invalid response format from OpenWeatherMap)

I haven't debugged yet and I will soon, but has anyone experienced this? I have a Free api key from openweather.

Openssl error while building module with cargo

Hello @kamek-pf
Thank you for your module, it looks great but I can't compile the program

I try to run the "cargo build --release" command in the polybar-forecast directory.

I get this error :

Compiling openssl v0.9.24
error: failed to run custom build command for openssl v0.9.24
process didn't exit successfully: ~/.config/polybar/modules/polybar-forecast/target/release/build/openssl-1a53f5853bfeae35/build-script-build (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: Run with RUST_BACKTRACE=1 for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

Do you have any idea about what is wrong ?

Icon not showing on Polybar

Polybar only displays the current temperature, i have the following fonts installed:
noto-fonts-all 20181224-1
siji-git r23.c691f20-1
ttf-material-icons-git r124.224895a86-1
ttf-unifont 13.0.02-1
ttf-weather-icons 2.0.10-3
log of polybar: warn: Dropping unmatched character  (U+f041)

Unmatched Characters in Polybar

Hi there,

I have polybar-forecast working perfectly with my polybar config, but I wanted to point out a font dependency which hasn't been mentioned: you need a font which has a glyph for the following characters:

U+E8E5 <Private Use>
U+E8E4 <Private Use>
U+E8E3 <Private Use>

Weather Icons doesn't supply these - what should these icons be, and which fonts would you recommend we use for them?

Invalid response from OpenWeatherMap

Hi, I have copied your script (v1.1.0 from releases page) and copied inside my polybar config folder. I have chmod the script and also created the config.toml file in the same folder of the script (which I modified with my openweathermap apikey and city code).

However, when I just launch the script I get this error (and thus no information on my polybar):

➜  ~ .config/polybar/scripts/forecast

Invalid response from OpenWeatherMap
➜  ~

Do you know what I am doing wrong?

Installation issues

I have Arch bspwm on my device. I installed ntfd from AUR. I have the same issue as the one of the previous issues. Temperatures are correct but icons are something are random. I have tried setting Weather icons font-0 and font-9 as well.. None of this works. Please help.

Add option to specificy which elements to display

Greetings! Would it be possible to extend the configuration to allow for some customization of which elements should be displayed in the output?

In particular, there are a couple tweaks I would find useful:

  • toggle display of 3-hr forecast
  • add option to display both units (e.g. "32F (0C)")

Problem with weather icons

Hello again @kamek-pf

Sorry to bother you but I now have some troubles with the weather icons font.
I installed the font package but it seems the module isn't using the font.

You'll see your weather module on the bottom right of the screenshot

screeshot

Do you know how I could fix this ?

Add support for reading OWM API key from an environmental variable?

Got one more request for ya... ;)

Would it be possible/difficult to extend the polybar configuration to support reading API keys from environmental variables?

This way the polybar-forecast config could be safely stored in a dots repo, while the API key could be stored in a separate more secure location.

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.