From 443b2a130d6e6bd1a509ae2dac1f4abac0ac6a98 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Wed, 25 Oct 2017 22:09:27 +0200 Subject: [PATCH] hihi --- herbstluftwm/hl_status_deamon.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/herbstluftwm/hl_status_deamon.py b/herbstluftwm/hl_status_deamon.py index 41bbee1..df5f325 100755 --- a/herbstluftwm/hl_status_deamon.py +++ b/herbstluftwm/hl_status_deamon.py @@ -17,6 +17,17 @@ bat_prev = -1 def sigusr1_handler(signum, frame): save() +def sigusr2_handler(signum, frame): + cmd="wget --timeout=3 -O- --user cip --password "+pw()+" --quiet 'https://atlantishq.de/ciplog/"+socket.gethostname()+"&inactive&"+"none'" + try: + hl_utils.shexec(cmd) + except: + pass + cip_logins(socket.gethostname()) + sys.exit(0) + + + def pw(): pw="NOPE" try: @@ -26,7 +37,7 @@ def pw(): return "" -def cip_logins(): +def cip_logins(ignore=""): MAX_LOGINS=5 cmd="wget -q -O- --user cip --password "+pw()+" 'https://atlantishq.de/cipactive/active_logins'" try: @@ -35,14 +46,15 @@ def cip_logins(): return "" if len(l) > MAX_LOGINS: - ret = hl_utils.color_panel("CIP Logins: "+str(len(l)),RED) + ret = hl_utils.color_panel("Logins: "+str(len(l)),RED) elif len(l) <= 1: ret = "" else: color = hl_utils.get_color(len(l),MAX_LOGINS,0) ret='' + l=sorted(l) for line in l: - if line =='': + if line =='' or line==ignore: continue ret = ret + line + ", " ret = ret[:-len(", ")] @@ -189,6 +201,7 @@ def trace_login(): if __name__ == '__main__': signal.signal(signal.SIGUSR1,sigusr1_handler) + signal.signal(signal.SIGUSR2,sigusr2_handler) signal.siginterrupt(signal.SIGUSR1, True) while(True): if sys.argv[-1] in ['--refresh','-r']: