diff --git a/herbstluftwm/hl_panel_content.py b/herbstluftwm/hl_panel_content.py index d4dc2d2..0addee7 100755 --- a/herbstluftwm/hl_panel_content.py +++ b/herbstluftwm/hl_panel_content.py @@ -35,12 +35,15 @@ def vpn(): return tmp; def ip(): - with open(hl_utils.hlpath(IP_LOG)) as f: - tmp = f.read() - if len(tmp) > 20: - tmp = hl_utils.color_panel("Public IP: IP6 ",GREEN) - tmp = ' '+tmp - return tmp; + try: + with open(hl_utils.hlpath(IP_LOG)) as f: + tmp = f.read() + if "[" in tmp: + tmp = hl_utils.color_panel("Public IP: IP6 ",GREEN) + tmp = ' '+tmp + return tmp; + except Exception: + return hl_utils.color_panel("Public IP: No Data",YELLOW) def battery(): if hl_utils.is_laptop(): @@ -68,8 +71,8 @@ def bcw(): try: with open(hl_utils.hlpath(BC_WORD_LOG),'r') as f: tmp = int(f.read()) - string = "{} of 6000 words".format(tmp) - return hl_utils.color_panel(string,hl_utils.get_color(tmp,0,6000,reverse=False)) + string = "{} words".format(tmp) + return hl_utils.color_panel(string,hl_utils.get_color(tmp,0,12000,reverse=False)) except: return "" def bwp(): diff --git a/herbstluftwm/hl_status_deamon.py b/herbstluftwm/hl_status_deamon.py index f6d4c40..f1c817f 100755 --- a/herbstluftwm/hl_status_deamon.py +++ b/herbstluftwm/hl_status_deamon.py @@ -172,30 +172,34 @@ def pr_acct_status(): f.write(out) def bc_words(): + try: with open(hl_utils.hlpath(BC_WORD_LOG),'w') as g: - tmp = hl_utils.shexec("wc -w {}".format(hl_utils.hlpath(".bctext",use_hostname=False))) - tmp = tmp.split()[0] - g.write(tmp) + tmp = len(hl_utils.shexec("pdftotext {} -".format(\ + hl_utils.hlpath(".bcpdf",use_hostname=False))).split(" ")) + g.write(str(tmp)) + except subprocess.CalledProcessError: + pass + def bc_pages(): - hl_utils.shexec("pandoc {} -o {}".format(\ - hl_utils.hlpath(".bctext",use_hostname=False),\ - hl_utils.hlpath("test.pdf",use_hostname=False))) - arr = hl_utils.shexec("pdftk {} dump_data".format(\ - hl_utils.hlpath("test.pdf",use_hostname=False))) - arr = arr.split("\n") - lol = "lolcannon" - for el in arr: - if "NumberOfPages" in el: - try: - with open(hl_utils.hlpath(BC_PAGE_LOG),'r') as f: - if int(f.read()) == int(el): - break - except: - pass - lol = el - break - with open(hl_utils.hlpath(BC_PAGE_LOG),"w") as g: - g.write(el.split()[1]) + try: + arr = hl_utils.shexec("pdftk {} dump_data".format(\ + hl_utils.hlpath(".bcpdf",use_hostname=False))) + arr = arr.split("\n") + lol = "lolcannon" + for el in arr: + if "NumberOfPages" in el: + try: + with open(hl_utils.hlpath(BC_PAGE_LOG),'r') as f: + if int(f.read()) == int(el): + break + except: + pass + lol = el + break + with open(hl_utils.hlpath(BC_PAGE_LOG),"w") as g: + g.write(el.split()[1]) + except subprocess.CalledProcessError: + pass def vpn_status(): if not hl_utils.is_cip(): diff --git a/htop/htoprc b/htop/htoprc index 72d7adb..17f4cb6 100644 --- a/htop/htoprc +++ b/htop/htoprc @@ -12,7 +12,7 @@ show_program_path=1 highlight_base_name=0 highlight_megabytes=1 highlight_threads=1 -tree_view=0 +tree_view=1 header_margin=1 detailed_cpu_time=0 cpu_count_from_zero=0