feat: clear screen on SIGUSR1

This commit is contained in:
Johann Dreo 2024-02-18 07:51:39 +01:00
commit 9df608901c

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import copy import copy
import signal
import datetime import datetime
import collections import collections
@ -221,6 +222,8 @@ class Broker:
self.deck = collections.deque() self.deck = collections.deque()
signal.signal(signal.SIGUSR1, self.sigusr1)
DBusGMainLoop(set_as_default=True) DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus() bus = dbus.SessionBus()
@ -254,6 +257,11 @@ class Broker:
self.print() self.print()
def sigusr1(self, signum, stack):
self.deck.clear()
self.print()
def width(self, deck): def width(self, deck):
w = 0 w = 0
for msg,mlen in deck: for msg,mlen in deck: