from parse_config_file import get_bar_config_and_module_config_list from os import getenv from os.path import exists def generate_flags(bar_config): flags = "" for option in bar_config: match option: case 'geometry': flags += (" -g '" + bar_config[option] + "'") case 'bottom': flags += (" -b") case 'force': flags += (" -d") case 'font': flags += (" -f '" + bar_config[option] + "'") case 'name': flags += (" -n '" + bar_config[option] + "'") case 'line_thickness': flags += (" -u " + str(bar_config[option])) case 'bg_color': flags += (" -B '" + bar_config[option] + "'") case 'fg_color': flags += (" -F '" + bar_config[option] + "'") case 'offset': flags += (" -o " + str(bar_config[option])) case 'line_color': flags += (" -U '" + bar_config[option] + "'") return flags.strip() if exists("./data/testing_config.yml"): config_file = "./data/testing_config.yml" else: config_file = str(getenv("HOME")) + "/.config/easyconf-lemonbar.yml" bar_config, module_config_list = get_bar_config_and_module_config_list(config_file) print(generate_flags(bar_config))