mirror of
https://github.com/FAUSheppy/config
synced 2025-12-09 16:18:33 +01:00
added pracct deamon
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
14
herbstluftwm/hl_pracct_deamon.py
Executable file
14
herbstluftwm/hl_pracct_deamon.py
Executable 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()
|
||||
Reference in New Issue
Block a user