mirror of
https://github.com/FAUSheppy/config
synced 2025-12-09 16:18:33 +01:00
fixed some problems after stretch update
This commit is contained in:
@@ -13,7 +13,7 @@ def color_remove(s):
|
||||
return re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]').sub('',s)
|
||||
|
||||
def shexec(s):
|
||||
return subprocess.check_output(shlex.split(s)).decode()
|
||||
return subprocess.check_output(shlex.split(s),shell=True).decode()
|
||||
|
||||
def is_cip():
|
||||
u = os.uname()
|
||||
|
||||
@@ -118,7 +118,7 @@ hc pad $monitor $panel_height
|
||||
echo -n "^bg()^fg() ${windowtitle//^/^^}"
|
||||
|
||||
####################### Interface to python layer #########################
|
||||
right="$($HOME/.config/herbstluftwm/panel_content.py) $date"
|
||||
right="30. Mai 14 Kobras |$($HOME/.config/herbstluftwm/panel_content.py) $date"
|
||||
|
||||
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
|
||||
# get width of right aligned text.. and add some space..
|
||||
|
||||
@@ -56,6 +56,7 @@ def get_color(nr,start,end):
|
||||
|
||||
|
||||
def guthaben():
|
||||
guthaben = ''
|
||||
if hl_utils.is_cip():
|
||||
tmp = -1
|
||||
with open(hl_utils.hlpath("pracct.log")) as f:
|
||||
@@ -65,13 +66,15 @@ def guthaben():
|
||||
guthaben = color_panel(guthaben,col)
|
||||
return guthaben;
|
||||
|
||||
|
||||
def battery():
|
||||
if hl_utils.is_laptop():
|
||||
try:
|
||||
bat = hl_utils.shexec("acpi -b | sed -r 's/Battery [0-9]+: //")
|
||||
return color_panel(bat,get_color(int(bar.rstrip('%')),0,100))
|
||||
except(ValueError):
|
||||
return color_panel("acpi or sed not in path",RED)
|
||||
bat = hl_utils.shexec("acpi -b")
|
||||
bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
|
||||
return color_panel(bat.strip('\n'),get_color(int(bat.split('%')[0][-2:].rstrip('%')),0,100))
|
||||
except ValueError as e:
|
||||
return color_panel(str(e),RED)
|
||||
else:
|
||||
return ""
|
||||
|
||||
@@ -96,5 +99,8 @@ def irc():
|
||||
ret_string = "MSG FROM: "+user+"-> "+msg.rstrip('\n')+" - [ "+str(len(tmp))+" total ]"
|
||||
return color_panel(ret_string,RED)
|
||||
except(IOError):
|
||||
return ""
|
||||
print(irc(),guthaben(),battery())
|
||||
pass
|
||||
else:
|
||||
return ''
|
||||
|
||||
print(irc(),guthaben(),battery(),sep='')
|
||||
|
||||
Reference in New Issue
Block a user