From bcbde507eb857a67a25fe415a133fd7e639a6bdf Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 12 Jul 2020 17:36:28 -0400 Subject: [weather] fix #161 + redesign with breaking change --- weather-widget/README.md | 94 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 24 deletions(-) (limited to 'weather-widget/README.md') diff --git a/weather-widget/README.md b/weather-widget/README.md index 730c1f5..defe1b7 100644 --- a/weather-widget/README.md +++ b/weather-widget/README.md @@ -1,8 +1,13 @@ # Weather widget -![Weather Widget](./weather-widget.png) +

+ screenshot +

-Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder. +Widget consists of three sections: + - current weather, including humidity, wind speed, UV index + - hourly forecast for the next 24 hours + - daily forecast for the next five days ## Customization @@ -10,33 +15,62 @@ It is possible to customize widget by providing a table with all or some of the | Name | Default | Description | |---|---|---| -| `font` | `Play 9` | Font | -| `city` | `Montreal,ca` | City name and country code, [more info](https://openweathermap.org/current) | -| `api_key` | none| API key, required | -| `units` | `metric` | `metric` for celsius, `imperial` for fahrenheit | -| `both_units_widget` | `false` | show temperature in both units (15°C (59°F)) or in one (15°C) | -| `both_units_popup` | `false` | same as above but for popup | -| `notification_position` | `top_right` | The notification position | +| coordinates | Required | Table with two elements: latitude and longitude, e.g. `{46.204400, 6.143200}` | +| api_key | Required | Get it [here](https://openweathermap.org/appid) | +| font_name | `beautiful.font:gsub("%s%d+$", "")` | **Name** of the font to use e.g. 'Play' | +| both_units_widget | false | Show temperature in both units - '28°C (83°F) | +| units | metric | `metric` for celsius, `imperial` for fahrenheit | +| show_hourly_forecast | false | Show hourly forecase section | +| time_format_12h |false | 12 or 24 hour format (13:00 - default or 1pm) | +| show_daily_forecast | false | Show daily forecast section | +| icon_pack_name | weather-underground-icons | Name of the icon pack, could be `weather-underground-icon` or `VitalyGorbachev` or create your own, more details below | +| icons_extension | `.svg` | File extension of icons in the pack | -### Example: +### Icons: + +Widget comes with two predefined icon packs: + + - weather-underground-icons taken from [here](https://github.com/manifestinteractive/weather-underground-icons) + - VitalyGorbachev taken from [here](https://www.flaticon.com/authors/vitaly-gorbachev) + +To add your custom icons, create a folder with the pack name under `/icons` and use the folder name in widget's config. There should be 18 icons, preferably 128x128 minimum. Icons should also respect the naming convention, please check widget's source. + +### Examples: + + +#### Custom font, icons + +![example1](./screenshots/example1.png) ```lua -weather_widget({ - api_key = 'your-api-key', +weather_curl_widget({ + api_key='', + coordinates = {45.5017, -73.5673}, + time_format_12h = true, units = 'imperial', - font = 'Ubuntu Mono 9' + both_units_widget = true, + font_name = 'Carter One', + icons = 'VitalyGorbachev', + show_hourly_forecast = true, + show_daily_forecast = true, }), ``` +#### Only current weather -## Installation +![example2](./screenshots/example2.png) -1. Install lua socket - to make HTTP calls to get the weather information. +```lua +weather_curl_widget({ + api_key='', + coordinates = {45.5017, -73.5673}, +}), +``` - ```bash - $ sudo apt-get install lua-socket - ``` + + +## Installation 1. Download json parser for lua from [github.com/rxi/json.lua](https://github.com/rxi/json.lua) and place it under **~/.config/awesome/** (don't forget to star a repo ): @@ -66,15 +100,27 @@ weather_widget({ layout = wibox.layout.fixed.horizontal, ... --default - weather_widget({api_key = 'your-api-key'}), - --customized weather_widget({ - api_key = 'your-api-key', + coordinates = {45.5017, -73.5673}, + api_key='c3d7320b359da4e48c2d682a04076576', + }), + , + --customized + weather_curl_widget({ + api_key='', + coordinates = {45.5017, -73.5673}, + time_format_12h = true, units = 'imperial', - font = 'Ubuntu Mono 9' - }) + both_units_widget = true, + font_name = 'Carter One', + icons = 'VitalyGorbachev', + show_hourly_forecast = true, + show_daily_forecast = true, + }), ... ``` -You can read how it works in more details [here](http://pavelmakhov.com/2017/02/weather-widget-for-awesome-wm) +## How it works + +TBW \ No newline at end of file -- cgit v1.2.3