renamed hl_error to utils and changed dependencies also initial commit for panel content that will replace the right side in panel.sh

This commit is contained in:
Sheppy
2017-02-24 17:08:06 +01:00
parent ecec279967
commit 61d9ea1fc7
4 changed files with 3 additions and 2 deletions

22
herbstluftwm/hl_utils.py Executable file
View File

@@ -0,0 +1,22 @@
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:
time = str(datetime.datetime.now().time())[:-7] #cut seconds at the end
f.write(time + "ERROR" + os.path.basename(__file__) + s)