easyconf-lemonbar/easyconf_lemonbar/lemonbar_command.py

39 lines
1.3 KiB
Python
Raw Normal View History

2023-03-12 00:36:22 +00:00
from parse_config_file import get_bar_config_and_module_config_list
from os import getenv
from os.path import exists
2023-03-12 00:36:22 +00:00
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)
2023-03-12 00:36:22 +00:00
print(generate_flags(bar_config))