added pracct deamon

This commit is contained in:
Sheppy
2017-02-24 16:55:07 +01:00
parent ff74c8b72d
commit 2916f38011
3 changed files with 32 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ xsetroot -solid '#5A8E3A'
hc keyunbind --all
pkill dunst
pkill xautolock
pkill -s 15 hl_pracct_deamon #send SIGTERM for correct termination during write
#variables
Mod=Mod4 # Use the super key as the main modifier
@@ -36,6 +37,9 @@ fi
######### GENERAL SETUP #########
### Start Pythonscripts ###
~/.config/herbstluftwm/hl_pracct_deamon.py &
# keybindings
#client handling
hc keybind $Mod-Shift-q quit

View File

@@ -1,6 +1,20 @@
import datetime
import sys
import os
import subprocess
import shlex
import re
def color_remove(s):
'''removes colorcodes from inputstring'''
return re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]').sub('',s)
def shexec(s):
return subprocess.check_output(shlex.split(s)).decode()
def is_cip():
u = os.uname()
return "cip" in u.release or "faui" in u.name or "ircbox" in u.name
def error(s):
with open("herbstlog",'a') as f:

View File

@@ -0,0 +1,14 @@
#!/usr/bin/python3
import os
import sys
import time
from hl_error import error, is_cip, shexec, color_remove
#Druckerguthaben
if is_cip():
while(True):
out = color_remove(shexec("pr_acct").split("\n")[0]).split(' ')[-1]
with open("pracct.log",'w') as f :
f.write(out)
time.sleep(60)
sys.exit()