Merge branch 'master' of gitlab.cs.fau.de:ik15ydit/config

This commit is contained in:
Sheppy
2018-07-23 12:55:18 +02:00
2 changed files with 9 additions and 2 deletions

View File

@@ -29,10 +29,14 @@ def vpn():
if hl_utils.is_cip(): if hl_utils.is_cip():
return '' return ''
else: else:
try:
with open(hl_utils.hlpath(VPN_LOG)) as f: with open(hl_utils.hlpath(VPN_LOG)) as f:
tmp = f.read() tmp = f.read()
tmp = ' '+tmp tmp = ' '+tmp
return tmp; return tmp;
except FileNotFoundError:
return hl_utils.color_panel("NO VPN INFORMATION",YELLOW)
def ip(): def ip():
try: try:
@@ -52,8 +56,8 @@ def battery():
tmp = f.read() tmp = f.read()
tmp = ' '+tmp tmp = ' '+tmp
return tmp; return tmp;
except Exception as e: except FileNotFoundError as e:
return color_panel(str(e),RED) return hl_utils.color_panel(str(e),RED)
else: else:
return "" return ""

View File

@@ -202,6 +202,7 @@ def bc_pages():
pass pass
def vpn_status(): def vpn_status():
try:
if not hl_utils.is_cip(): if not hl_utils.is_cip():
out_vpn = hl_utils.shexec("ip r g 8.8.8.8").split("\n")[0] out_vpn = hl_utils.shexec("ip r g 8.8.8.8").split("\n")[0]
if "dev cip_tun" in out_vpn: if "dev cip_tun" in out_vpn:
@@ -210,6 +211,8 @@ def vpn_status():
out_vpn = hl_utils.color_panel("VPN: Link Down",RED) out_vpn = hl_utils.color_panel("VPN: Link Down",RED)
with open(hl_utils.hlpath(VPN_LOG),'w') as g: with open(hl_utils.hlpath(VPN_LOG),'w') as g:
g.write(out_vpn) g.write(out_vpn)
except Exception:
pass
def battery_status(): def battery_status():
if hl_utils.is_laptop(): if hl_utils.is_laptop():