mirror of
https://github.com/FAUSheppy/config
synced 2025-12-06 15:11:35 +01:00
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:
22
herbstluftwm/hl_utils.py
Executable file
22
herbstluftwm/hl_utils.py
Executable 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)
|
||||
Reference in New Issue
Block a user