[Weather] Add option to set the position of the notification

This commit is contained in:
Aurélien LAJOIE 2019-09-18 01:31:26 +02:00
parent 59ce0053ac
commit e154daa8b6
2 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,8 @@ It is possible to customize widget by providing a table with all or some of the
| `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 |
### Example:

View File

@ -28,6 +28,7 @@ local function worker(args)
local units = args.units or 'metric'
local both_units_widget = args.both_units_widget or false
local both_units_popup = args.both_units_popup or false
local position = args.notification_position or "top_right"
local weather_api_url = (
'https://api.openweathermap.org/data/2.5/weather'
@ -204,6 +205,7 @@ local function worker(args)
'<b>Clouds:</b> ' .. resp.clouds.all .. '%<br>' ..
'<b>Wind:</b> ' .. resp.wind.speed .. 'm/s (' .. to_direction(resp.wind.deg) .. ')',
timeout = 5, hover_timeout = 10,
position = position,
width = (both_units_popup == true and 210 or 200)
}
end)