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