refactored 'global_padding' to 'margin' for clarity

This commit is contained in:
Noah Swerhun 2023-03-11 12:15:26 -06:00
parent 1ae9b10caa
commit 5996d43105
3 changed files with 7 additions and 8 deletions

View file

@ -17,7 +17,7 @@ def get_validated_config(filename):
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("global_padding", default=""): str
Optional("margin", default=""): str
},
"modules": [
{

View file

@ -38,9 +38,8 @@ 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: ""
# Text to be placed on both ends of the bar, before and after all text.
margin: ""
# 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

View file

@ -9,7 +9,7 @@ def print_bar():
for alignment in running_modules_dict:
match alignment:
case "left":
print("%{l}" + global_padding, end="")
print("%{l}" + margin, end="")
case "center":
print("%{c}", end="")
case "right":
@ -27,7 +27,7 @@ def print_bar():
print(seperator, end="")
break;
if alignment == "right":
print(global_padding, end="")
print(margin, end="")
print(flush=True)
@ -53,12 +53,12 @@ def new_module_thread(alignment, pre, name, prefix, command, post, refresh):
def main():
global padding
global seperator
global global_padding
global margin
config = get_validated_config("./testing_config.yml")
padding = config["bar"]["config"]["padding"]
seperator = config["bar"]["config"]["seperator"]
global_padding = config["bar"]["config"]["global_padding"]
margin = config["bar"]["config"]["margin"]
modules = config["bar"]["modules"]