diff --git a/.gitignore b/.gitignore index 4cc414d..d5d0b68 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ testing_config.yml +__pycache__ diff --git a/__pycache__/config_parsing.cpython-310.pyc b/__pycache__/config_parsing.cpython-310.pyc deleted file mode 100644 index 6b925ea..0000000 Binary files a/__pycache__/config_parsing.cpython-310.pyc and /dev/null differ diff --git a/config_parsing.py b/config_parsing.py index aff2d78..9d128dc 100644 --- a/config_parsing.py +++ b/config_parsing.py @@ -16,7 +16,8 @@ def get_validated_config(filename): Optional("offset"): int, Optional("line_color"): Regex(r'^#[0-9a-fA-F]{3}$|^#[0-9a-fA-F]{6}$|^#[0-9a-fA-F]{8}$'), Optional("padding", default=" "): str, - Optional("seperator", default="|"): str + Optional("seperator", default="|"): str, + Optional("global_padding", default=""): str }, "modules": [ { diff --git a/example_config.yml b/example_config.yml index 6334e9c..e171608 100644 --- a/example_config.yml +++ b/example_config.yml @@ -38,6 +38,9 @@ bar: # Seperator between modules. Module formatting options are not applied to # the seperator. seperator: "|" + # Padding on either end of the bar itself. This will be placed before and + # after all text on the bar. + global_padding: "" # Here is where you can define a list your individual modules. You can define # as many modules as you want. Some fields are required; these will be diff --git a/main.py b/main.py index 83468f8..efb3b7b 100644 --- a/main.py +++ b/main.py @@ -9,7 +9,7 @@ def print_bar(): for alignment in running_modules_dict: match alignment: case "left": - print("%{l}", end="") + print("%{l}" + global_padding, end="") case "center": print("%{c}", end="") case "right": @@ -26,7 +26,9 @@ def print_bar(): if len(group[i]) > 0: print(seperator, end="") break; - + if alignment == "right": + print(global_padding, end="") + print(flush=True) def create_module_string(pre, prefix, command, post): @@ -51,10 +53,12 @@ def new_module_thread(alignment, pre, name, prefix, command, post, refresh): def main(): global padding global seperator + global global_padding config = get_validated_config("./testing_config.yml") padding = config["bar"]["config"]["padding"] seperator = config["bar"]["config"]["seperator"] + global_padding = config["bar"]["config"]["global_padding"] modules = config["bar"]["modules"]