Skip to content

Commit 2063b0e

Browse files
authored
feat: add auto hide functionality to calendar widget
1 parent effc902 commit 2063b0e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

calendar-widget/calendar.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,23 @@ local function worker(user_args)
203203
border_color = calendar_themes[theme].border,
204204
widget = cal
205205
}
206+
207+
local auto_hide_timer = gears.timer({
208+
timeout = user_args.timeout or 2,
209+
single_shot = true,
210+
callback = function()
211+
calendar_widget.toggle()
212+
end,
213+
})
214+
215+
popup:connect_signal("mouse::leave", function()
216+
if user_args.auto_hide then
217+
auto_hide_timer:again()
218+
end
219+
end)
220+
popup:connect_signal("mouse::enter", function()
221+
auto_hide_timer:stop()
222+
end)
206223

207224
popup:buttons(
208225
awful.util.table.join(
@@ -250,6 +267,10 @@ local function worker(user_args)
250267
end
251268

252269
popup.visible = true
270+
if user_args.auto_hide then
271+
auto_hide_timer:start()
272+
end
273+
253274

254275
end
255276
end

0 commit comments

Comments
 (0)