mirror of
https://github.com/FAUSheppy/config
synced 2025-12-10 00:28:32 +01:00
added pracct deamon
This commit is contained in:
@@ -14,6 +14,7 @@ xsetroot -solid '#5A8E3A'
|
|||||||
hc keyunbind --all
|
hc keyunbind --all
|
||||||
pkill dunst
|
pkill dunst
|
||||||
pkill xautolock
|
pkill xautolock
|
||||||
|
pkill -s 15 hl_pracct_deamon #send SIGTERM for correct termination during write
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
Mod=Mod4 # Use the super key as the main modifier
|
Mod=Mod4 # Use the super key as the main modifier
|
||||||
@@ -36,6 +37,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
######### GENERAL SETUP #########
|
######### GENERAL SETUP #########
|
||||||
|
### Start Pythonscripts ###
|
||||||
|
~/.config/herbstluftwm/hl_pracct_deamon.py &
|
||||||
|
|
||||||
# keybindings
|
# keybindings
|
||||||
#client handling
|
#client handling
|
||||||
hc keybind $Mod-Shift-q quit
|
hc keybind $Mod-Shift-q quit
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
import os
|
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):
|
def error(s):
|
||||||
with open("herbstlog",'a') as f:
|
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