From 87259502cfac8ea92a18f28faeee17d73491e437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Tue, 22 Oct 2024 09:04:01 +0200 Subject: [PATCH] feat: add preview on hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a nice contribution! Co-authored-by: trap000d Signed-off-by: André Jaenisch --- weather-api-widget/weather.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/weather-api-widget/weather.lua b/weather-api-widget/weather.lua index 35705ec0..20233ac1 100644 --- a/weather-api-widget/weather.lua +++ b/weather-api-widget/weather.lua @@ -619,6 +619,18 @@ local function worker(user_args) 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( string.format(GET_FORECAST_CMD, weather_api), timeout, -- API limit is 1k req/day; day has 1440 min; every 2 min is good