From 9df608901c44a0198e17947b366b6ddb12d55deb Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 18 Feb 2024 07:51:39 +0100 Subject: [PATCH] feat: clear screen on SIGUSR1 --- src/clibard/clibard.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/clibard/clibard.py b/src/clibard/clibard.py index 7dabf93..1243dbd 100755 --- a/src/clibard/clibard.py +++ b/src/clibard/clibard.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import copy +import signal import datetime import collections @@ -221,6 +222,8 @@ class Broker: self.deck = collections.deque() + signal.signal(signal.SIGUSR1, self.sigusr1) + DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() @@ -254,6 +257,11 @@ class Broker: self.print() + def sigusr1(self, signum, stack): + self.deck.clear() + self.print() + + def width(self, deck): w = 0 for msg,mlen in deck: