File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
14
14
| radius | 8 | The popup radius |
15
15
| start_sunday | false | Start the week on Sunday |
16
16
| week_numbers | false | Show ISO week numbers (Mon = first) |
17
+ | auto_hide | false | Auto hide the popup after timeout |
18
+ | timeout | 2 | Auto hide timeout length |
17
19
18
20
- themes:
19
21
Original file line number Diff line number Diff line change @@ -203,6 +203,23 @@ local function worker(user_args)
203
203
border_color = calendar_themes [theme ].border ,
204
204
widget = cal
205
205
}
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 )
206
223
207
224
popup :buttons (
208
225
awful .util .table .join (
@@ -226,6 +243,7 @@ local function worker(user_args)
226
243
function calendar_widget .toggle ()
227
244
228
245
if popup .visible then
246
+ auto_hide_timer :stop ()
229
247
-- to faster render the calendar refresh it and just hide
230
248
cal :set_date (nil ) -- the new date is not set without removing the old one
231
249
cal :set_date (os.date (' *t' ))
@@ -250,6 +268,10 @@ local function worker(user_args)
250
268
end
251
269
252
270
popup .visible = true
271
+ if user_args .auto_hide then
272
+ auto_hide_timer :start ()
273
+ end
274
+
253
275
254
276
end
255
277
end
You can’t perform that action at this time.
0 commit comments