From 505786cefe9d9ccba7644c90cf956bcf99963b84 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 9 Dec 2021 17:52:44 +0100 Subject: [PATCH] xsecurelock: check clock more often timeout_add is using a monotonic clock and therefore, we need to check for updates more often. --- bin/xsecurelock-saver | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/xsecurelock-saver b/bin/xsecurelock-saver index 85f4ddf..8080ea3 100755 --- a/bin/xsecurelock-saver +++ b/bin/xsecurelock-saver @@ -129,9 +129,11 @@ def on_background_change(monitor, f1, f2, event, ctx): def on_clock_change(ctx): now = datetime.datetime.now() - ctx.clock = now.strftime("%H:%M") - ctx.overlay.queue_draw() - GLib.timeout_add((60 - now.second) * 1000, on_clock_change, ctx) + new_clock = now.strftime("%H:%M") + if new_clock != ctx.clock: + ctx.clock = new_clock + ctx.overlay.queue_draw() + GLib.timeout_add(min(60 - now.second, 3) * 1000, on_clock_change, ctx) def on_weather_change(monitor, f1, f2, event, ctx):