diff --git a/weather-widget/README.md b/weather-widget/README.md
index 3bf62288..3989e821 100644
--- a/weather-widget/README.md
+++ b/weather-widget/README.md
@@ -25,7 +25,7 @@ It is possible to customize widget by providing a table with all or some of the
| Name | Default | Description |
|---|---|---|
-| coordinates | Required | Table with two elements: latitude and longitude, e.g. `{46.204400, 6.143200}` |
+| coordinates | Required | Table with two elements: latitude and longitude, e.g. `{46.204400, 6.143200}` or "ipBased" if you want to set it automatically|
| 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) |
diff --git a/weather-widget/icons/weather-underground-icons/broken-clouds-night.png b/weather-widget/icons/weather-underground-icons/broken-clouds-night.png
deleted file mode 100644
index 061d1cde..00000000
Binary files a/weather-widget/icons/weather-underground-icons/broken-clouds-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/broken-clouds-night.svg b/weather-widget/icons/weather-underground-icons/broken-clouds-night.svg
new file mode 100644
index 00000000..7af604b5
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/broken-clouds-night.svg
@@ -0,0 +1,18 @@
+
+
+
diff --git a/weather-widget/icons/weather-underground-icons/broken-clouds.png b/weather-widget/icons/weather-underground-icons/broken-clouds.png
deleted file mode 100755
index 5967d929..00000000
Binary files a/weather-widget/icons/weather-underground-icons/broken-clouds.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/broken-clouds.svg b/weather-widget/icons/weather-underground-icons/broken-clouds.svg
new file mode 100644
index 00000000..be14b7c6
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/broken-clouds.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/clear-sky-night.png b/weather-widget/icons/weather-underground-icons/clear-sky-night.png
deleted file mode 100644
index cc40d0f9..00000000
Binary files a/weather-widget/icons/weather-underground-icons/clear-sky-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/clear-sky-night.svg b/weather-widget/icons/weather-underground-icons/clear-sky-night.svg
new file mode 100644
index 00000000..2af0c4c0
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/clear-sky-night.svg
@@ -0,0 +1,11 @@
+
+
+
diff --git a/weather-widget/icons/weather-underground-icons/clear-sky.png b/weather-widget/icons/weather-underground-icons/clear-sky.png
deleted file mode 100755
index acf8e5cd..00000000
Binary files a/weather-widget/icons/weather-underground-icons/clear-sky.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/clear-sky.svg b/weather-widget/icons/weather-underground-icons/clear-sky.svg
new file mode 100644
index 00000000..8f6fc4e1
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/clear-sky.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/few-clouds-night.png b/weather-widget/icons/weather-underground-icons/few-clouds-night.png
deleted file mode 100644
index 9c34fab9..00000000
Binary files a/weather-widget/icons/weather-underground-icons/few-clouds-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/few-clouds-night.svg b/weather-widget/icons/weather-underground-icons/few-clouds-night.svg
new file mode 100644
index 00000000..88890f95
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/few-clouds-night.svg
@@ -0,0 +1,18 @@
+
+
+
diff --git a/weather-widget/icons/weather-underground-icons/few-clouds.png b/weather-widget/icons/weather-underground-icons/few-clouds.png
deleted file mode 100755
index 7580fc5a..00000000
Binary files a/weather-widget/icons/weather-underground-icons/few-clouds.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/few-clouds.svg b/weather-widget/icons/weather-underground-icons/few-clouds.svg
new file mode 100644
index 00000000..03e9b1bb
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/few-clouds.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/mist-night.png b/weather-widget/icons/weather-underground-icons/mist-night.png
deleted file mode 100755
index 102142a2..00000000
Binary files a/weather-widget/icons/weather-underground-icons/mist-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/mist-night.svg b/weather-widget/icons/weather-underground-icons/mist-night.svg
new file mode 100644
index 00000000..f2ea9eae
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/mist-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/mist.png b/weather-widget/icons/weather-underground-icons/mist.png
deleted file mode 100755
index 102142a2..00000000
Binary files a/weather-widget/icons/weather-underground-icons/mist.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/mist.svg b/weather-widget/icons/weather-underground-icons/mist.svg
new file mode 100644
index 00000000..f2ea9eae
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/mist.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/rain-night.png b/weather-widget/icons/weather-underground-icons/rain-night.png
deleted file mode 100755
index 49f0903c..00000000
Binary files a/weather-widget/icons/weather-underground-icons/rain-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/rain-night.svg b/weather-widget/icons/weather-underground-icons/rain-night.svg
new file mode 100644
index 00000000..46e73365
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/rain-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/rain.png b/weather-widget/icons/weather-underground-icons/rain.png
deleted file mode 100755
index 49f0903c..00000000
Binary files a/weather-widget/icons/weather-underground-icons/rain.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/rain.svg b/weather-widget/icons/weather-underground-icons/rain.svg
new file mode 100644
index 00000000..46e73365
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/rain.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/scattered-clouds-night.png b/weather-widget/icons/weather-underground-icons/scattered-clouds-night.png
deleted file mode 100755
index 63cb1b22..00000000
Binary files a/weather-widget/icons/weather-underground-icons/scattered-clouds-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/scattered-clouds-night.svg b/weather-widget/icons/weather-underground-icons/scattered-clouds-night.svg
new file mode 100644
index 00000000..27c6d484
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/scattered-clouds-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/scattered-clouds.png b/weather-widget/icons/weather-underground-icons/scattered-clouds.png
deleted file mode 100755
index 63cb1b22..00000000
Binary files a/weather-widget/icons/weather-underground-icons/scattered-clouds.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/scattered-clouds.svg b/weather-widget/icons/weather-underground-icons/scattered-clouds.svg
new file mode 100644
index 00000000..27c6d484
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/scattered-clouds.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/shower-rain-night.png b/weather-widget/icons/weather-underground-icons/shower-rain-night.png
deleted file mode 100755
index 49f0903c..00000000
Binary files a/weather-widget/icons/weather-underground-icons/shower-rain-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/shower-rain-night.svg b/weather-widget/icons/weather-underground-icons/shower-rain-night.svg
new file mode 100644
index 00000000..46e73365
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/shower-rain-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/shower-rain.png b/weather-widget/icons/weather-underground-icons/shower-rain.png
deleted file mode 100755
index 49f0903c..00000000
Binary files a/weather-widget/icons/weather-underground-icons/shower-rain.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/shower-rain.svg b/weather-widget/icons/weather-underground-icons/shower-rain.svg
new file mode 100644
index 00000000..46e73365
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/shower-rain.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/snow-night.png b/weather-widget/icons/weather-underground-icons/snow-night.png
deleted file mode 100755
index 0a7f006b..00000000
Binary files a/weather-widget/icons/weather-underground-icons/snow-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/snow-night.svg b/weather-widget/icons/weather-underground-icons/snow-night.svg
new file mode 100644
index 00000000..86b432ec
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/snow-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/snow.png b/weather-widget/icons/weather-underground-icons/snow.png
deleted file mode 100755
index 0a7f006b..00000000
Binary files a/weather-widget/icons/weather-underground-icons/snow.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/snow.svg b/weather-widget/icons/weather-underground-icons/snow.svg
new file mode 100644
index 00000000..86b432ec
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/snow.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/thunderstorm-night.png b/weather-widget/icons/weather-underground-icons/thunderstorm-night.png
deleted file mode 100755
index 21021043..00000000
Binary files a/weather-widget/icons/weather-underground-icons/thunderstorm-night.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/thunderstorm-night.svg b/weather-widget/icons/weather-underground-icons/thunderstorm-night.svg
new file mode 100644
index 00000000..36cdab10
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/thunderstorm-night.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/icons/weather-underground-icons/thunderstorm.png b/weather-widget/icons/weather-underground-icons/thunderstorm.png
deleted file mode 100755
index 21021043..00000000
Binary files a/weather-widget/icons/weather-underground-icons/thunderstorm.png and /dev/null differ
diff --git a/weather-widget/icons/weather-underground-icons/thunderstorm.svg b/weather-widget/icons/weather-underground-icons/thunderstorm.svg
new file mode 100644
index 00000000..36cdab10
--- /dev/null
+++ b/weather-widget/icons/weather-underground-icons/thunderstorm.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 4e8e659c..a106e282 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -123,6 +123,28 @@ local function uvi_index_color(uvi)
return '' .. uvi .. ''
end
+local function get_coordinates(val)
+ local coordinates = val
+ if val == "ipBased" then
+ local geofile = "/tmp/geo.json"
+ if not gears.filesystem.file_readable(geofile) then
+ local handle = os.execute("curl -H 'Accept:application/json' ipinfo.io/json -s -o " .. geofile)
+ if handle then
+ show_warning("fail to get coordinates from ip")
+ end
+ end
+ local file = io.open( geofile,"r")
+ local result = file:read("*all")
+ result = json.decode(result)
+ file:close()
+ coordinates = {}
+ for match in result.loc:gmatch("[^,%s]+") do
+ coordinates[#coordinates + 1] = tonumber(match)
+ end
+ end
+ return coordinates
+end
+
local function worker(user_args)
local args = user_args or {}
@@ -135,7 +157,7 @@ local function worker(user_args)
return
end
- local coordinates = args.coordinates
+ local coordinates = get_coordinates(args.coordinates)
local api_key = args.api_key
local font_name = args.font_name or beautiful.font:gsub("%s%d+$", "")
local units = args.units or 'metric'