Skip to content

Commit fa4ff8b

Browse files
committed
feat: configuration option for hover forecast
Based on a request this is now configurable. Signed-off-by: André Jaenisch <[email protected]>
1 parent 81cd341 commit fa4ff8b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

weather-api-widget/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ following config parameters:
1818
| units | `metric` | `metric` for celsius, `imperial` for fahrenheit |
1919
| 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 |
2020
| icons_extension | `.png` | File extension of icons in the pack |
21+
| show_forecast_on_hover | false | Show a forecast on hover, too |
2122
| show_daily_forecast | false | Show forecast for next three days |
2223
| show_hourly_forecast | false | Show hourly forecast section |
2324
| timeout | 120 | How often in seconds the widget refreshes |

weather-api-widget/weather.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ local function worker(user_args)
176176
local both_units_widget = args.both_units_widget or false
177177
local icon_pack_name = args.icons or 'weather-underground-icons'
178178
local icons_extension = args.icons_extension or '.png'
179+
local show_forecast_on_hover = args.show_forecast_on_hover or false
179180
local show_daily_forecast = args.show_daily_forecast or false
180181
local show_hourly_forecast = args.show_hourly_forecast or false
181182
local timeout = args.timeout or 120
182-
183183
local ICONS_DIR = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/'
184184
-- Forecast endpoint includes current. I could map show_daily_forecast to days here.
185185
-- Currently overfetching but only showing when opting in.
@@ -640,12 +640,14 @@ local function worker(user_args)
640640
end)))
641641

642642
weather_widget:connect_signal("mouse::enter", function()
643-
weather_widget:set_bg(beautiful.bg_focus)
644-
weather_popup:move_next_to(mouse.current_widget_geometry)
643+
if show_forecast_on_hover then
644+
weather_widget:set_bg(beautiful.bg_focus)
645+
weather_popup:move_next_to(mouse.current_widget_geometry)
646+
end
645647
end)
646648

647649
weather_widget:connect_signal("mouse::leave", function()
648-
if weather_popup.visible then
650+
if show_forecast_on_hover and weather_popup.visible then
649651
weather_widget:set_bg('#00000000')
650652
weather_popup.visible = not weather_popup.visible
651653
end

0 commit comments

Comments
 (0)