feat: add preview on hover

This was a nice contribution!

Co-authored-by: trap000d

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
André Jaenisch 2024-10-22 09:04:01 +02:00
parent f5e81dea79
commit 87259502cf
No known key found for this signature in database
GPG Key ID: 5A668E771F1ED854
1 changed files with 12 additions and 0 deletions

View File

@ -619,6 +619,18 @@ local function worker(user_args)
end end
end))) end)))
weather_widget:connect_signal("mouse::enter", function()
weather_widget:set_bg(beautiful.bg_focus)
weather_popup:move_next_to(mouse.current_widget_geometry)
end)
weather_widget:connect_signal("mouse::leave", function()
if weather_popup.visible then
weather_widget:set_bg('#00000000')
weather_popup.visible = not weather_popup.visible
end
end)
watch( watch(
string.format(GET_FORECAST_CMD, weather_api), string.format(GET_FORECAST_CMD, weather_api),
timeout, -- API limit is 1k req/day; day has 1440 min; every 2 min is good timeout, -- API limit is 1k req/day; day has 1440 min; every 2 min is good