diff --git a/nwg_panel/dwl_interface.py b/nwg_panel/dwl_interface.py index 1376b77..eb09ed8 100644 --- a/nwg_panel/dwl_interface.py +++ b/nwg_panel/dwl_interface.py @@ -15,7 +15,6 @@ import fileinput import os import sys import json -import argparse from time import sleep @@ -66,13 +65,7 @@ def get_config_dir(): def main(): - parser = argparse.ArgumentParser() - parser.add_argument("-s", - "--signal", - type=int, - default=10, - help="signal to refresh dwl-tags module; default: 10 (SIGUSR1)") - args = parser.parse_args() + refresh_signal = os.getenv("SIG") if os.getenv("SIG") else 10 outputs = list_outputs() if len(outputs) > 0: @@ -145,7 +138,7 @@ def main(): with open(output_file, 'w') as fp: json.dump(data, fp, indent=4) - subprocess.Popen("pkill -f -{} nwg-panel".format(args.signal), shell=True) + subprocess.Popen("pkill -f -{} nwg-panel".format(refresh_signal), shell=True) cnt = 0 diff --git a/nwg_panel/main.py b/nwg_panel/main.py index 89195ba..877b3bc 100644 --- a/nwg_panel/main.py +++ b/nwg_panel/main.py @@ -203,18 +203,18 @@ def instantiate_content(panel, container, content_list, icons_path=""): container.pack_start(cpu_avg, False, False, panel["items-padding"]) if item == "dwl-tags": - #if os.path.isfile(common.dwl_data_file): - if "dwl-tags" not in panel: - panel["dwl-tags"] = {} + if os.path.isfile(common.dwl_data_file): + if "dwl-tags" not in panel: + panel["dwl-tags"] = {} - dwl_tags = DwlTags(panel["output"], panel["dwl-tags"]) - common.dwl_instances.append(dwl_tags) - container.pack_start(dwl_tags, False, False, panel["items-padding"]) - dwl_data = load_json(common.dwl_data_file) - if dwl_data: - dwl_tags.refresh(dwl_data) - #else: - # print("{} data file not found".format(common.dwl_data_file)) + dwl_tags = DwlTags(panel["output"], panel["dwl-tags"]) + common.dwl_instances.append(dwl_tags) + container.pack_start(dwl_tags, False, False, panel["items-padding"]) + dwl_data = load_json(common.dwl_data_file) + if dwl_data: + dwl_tags.refresh(dwl_data) + else: + print("{} data file not found".format(common.dwl_data_file)) def main():