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("line_color"): Regex(r'^#[0-9a-fA-F]{3}$|^#[0-9a-fA-F]{6}$|^#[0-9a-fA-F]{8}$'),
Optional("padding", default=" "): str, Optional("padding", default=" "): str,
Optional("seperator", default="|"): str, Optional("seperator", default="|"): str,
Optional("global_padding", default=""): str Optional("margin", default=""): str
}, },
"modules": [ "modules": [
{ {

View file

@ -38,9 +38,8 @@ bar:
# Seperator between modules. Module formatting options are not applied to # Seperator between modules. Module formatting options are not applied to
# the seperator. # the seperator.
seperator: "|" seperator: "|"
# Padding on either end of the bar itself. This will be placed before and # Text to be placed on both ends of the bar, before and after all text.
# after all text on the bar. margin: ""
global_padding: ""
# Here is where you can define a list your individual modules. You can define # 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 # 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: for alignment in running_modules_dict:
match alignment: match alignment:
case "left": case "left":
print("%{l}" + global_padding, end="") print("%{l}" + margin, end="")
case "center": case "center":
print("%{c}", end="") print("%{c}", end="")
case "right": case "right":
@ -27,7 +27,7 @@ def print_bar():
print(seperator, end="") print(seperator, end="")
break; break;
if alignment == "right": if alignment == "right":
print(global_padding, end="") print(margin, end="")
print(flush=True) print(flush=True)
@ -53,12 +53,12 @@ def new_module_thread(alignment, pre, name, prefix, command, post, refresh):
def main(): def main():
global padding global padding
global seperator global seperator
global global_padding global margin
config = get_validated_config("./testing_config.yml") config = get_validated_config("./testing_config.yml")
padding = config["bar"]["config"]["padding"] padding = config["bar"]["config"]["padding"]
seperator = config["bar"]["config"]["seperator"] seperator = config["bar"]["config"]["seperator"]
global_padding = config["bar"]["config"]["global_padding"] margin = config["bar"]["config"]["margin"]
modules = config["bar"]["modules"] modules = config["bar"]["modules"]