2023-04-03 19:03:37 +00:00
|
|
|
from os import getenv
|
|
|
|
from os.path import exists
|
2023-02-10 23:23:02 +00:00
|
|
|
|
2023-04-03 20:58:45 +00:00
|
|
|
from easyconf_lemonbar.parse_config_file import get_bar_config_and_monitor_list
|
|
|
|
|
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()
|
2023-02-10 23:23:02 +00:00
|
|
|
|
2023-04-03 19:03:37 +00:00
|
|
|
if exists("./data/testing_config.yml"):
|
|
|
|
config_file = "./data/testing_config.yml"
|
|
|
|
else:
|
|
|
|
config_file = str(getenv("HOME")) + "/.config/easyconf-lemonbar.yml"
|
|
|
|
|
2023-04-03 20:58:45 +00:00
|
|
|
bar_config, monitor_list = get_bar_config_and_monitor_list(config_file)
|
2023-03-12 00:36:22 +00:00
|
|
|
|
|
|
|
print(generate_flags(bar_config))
|