awesome-wm-widgets/_widgets/weather-widget.md

51 lines
1.5 KiB
Markdown
Raw Normal View History

---
layout: page
---
# Weather widget
2018-09-25 01:18:45 +02:00
![Weather Widget]({{'/assets/img/screenshots/weather-widget.png' | relative_url }}){:.center-image}
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.
## Installation
2018-09-25 01:18:45 +02:00
1. Install lua socket - to make HTTP calls to get the weather information.
```bash
$ sudo apt-get install lua-socket
```
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 <i class="fa fa-github-alt"></i> ):
```bash
wget -P ~/.config/awesome/ https://raw.githubusercontent.com/rxi/json.lua/master/json.lua
```
1. Get Open Weather Map app id here: [openweathermap.org/appid](https://openweathermap.org/appid) and place it in the widget's header.
1. Clone this repo under **~/.config/awesome/**:
```bash
git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/
```
2018-10-16 18:36:33 +02:00
1. Require weather widget at the beginning of **rc.lua**:
2018-09-25 01:18:45 +02:00
```lua
local weather_widget = require("awesome-wm-widgets.weather-widget.weather")
```
1. Add widget to the tasklist:
```lua
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
weather_widget,
...
```
2018-09-15 23:33:42 +02:00
You can read how it works in more details [here](http://pavelmakhov.com/2017/02/weather-widget-for-awesome-wm)