diff --git a/herbstluftwm/hl_panel_content.py b/herbstluftwm/hl_panel_content.py index a6d2708..1b5a59f 100755 --- a/herbstluftwm/hl_panel_content.py +++ b/herbstluftwm/hl_panel_content.py @@ -29,10 +29,14 @@ def vpn(): if hl_utils.is_cip(): return '' else: + try: with open(hl_utils.hlpath(VPN_LOG)) as f: tmp = f.read() tmp = ' '+tmp return tmp; + except FileNotFoundError: + return hl_utils.color_panel("NO VPN INFORMATION",YELLOW) + def ip(): try: @@ -52,8 +56,8 @@ def battery(): tmp = f.read() tmp = ' '+tmp return tmp; - except Exception as e: - return color_panel(str(e),RED) + except FileNotFoundError as e: + return hl_utils.color_panel(str(e),RED) else: return "" diff --git a/herbstluftwm/hl_status_deamon.py b/herbstluftwm/hl_status_deamon.py index 642a2db..f68ca59 100755 --- a/herbstluftwm/hl_status_deamon.py +++ b/herbstluftwm/hl_status_deamon.py @@ -202,6 +202,7 @@ def bc_pages(): pass def vpn_status(): + try: if not hl_utils.is_cip(): out_vpn = hl_utils.shexec("ip r g 8.8.8.8").split("\n")[0] if "dev cip_tun" in out_vpn: @@ -210,6 +211,8 @@ def vpn_status(): out_vpn = hl_utils.color_panel("VPN: Link Down",RED) with open(hl_utils.hlpath(VPN_LOG),'w') as g: g.write(out_vpn) + except Exception: + pass def battery_status(): if hl_utils.is_laptop():