added no-refresh feature

This commit is contained in:
Noah Swerhun 2023-02-18 13:14:08 -06:00
parent 3b6fa63e7b
commit ef21228dcf
4 changed files with 6 additions and 3 deletions

View file

@ -22,7 +22,7 @@ def get_validated_config(filename):
{ {
"name": str, "name": str,
"command": str, "command": str,
"refresh": And(int, lambda n : n > 0), "refresh": And(int, lambda n : n >= 0),
Optional("prefix"): str, Optional("prefix"): str,
"format": { "format": {
"align": Or("left", "center", "right"), "align": Or("left", "center", "right"),

View file

@ -53,8 +53,9 @@ bar:
# text that will be displayed for this module. `date` here is used as an # text that will be displayed for this module. `date` here is used as an
# example. THIS IS A REQUIRED FIELD. # example. THIS IS A REQUIRED FIELD.
command: "date" command: "date"
# How often to re-run the command and display the updated text. THIS IS A # How often (in milliseconds) to re-run the command and display the
# REQUIRED FIELD. # updated text. If this value is 0, then the module will not be
# refreshed. THIS IS A REQUIRED FIELD.
refresh: 1000 refresh: 1000
# Prefix to be printed before the text of the command. # Prefix to be printed before the text of the command.
prefix: "DATE: " prefix: "DATE: "

View file

@ -36,6 +36,8 @@ def new_module_thread(alignment, pre, name, prefix, command, post, refresh):
module_string = create_module_string(pre, prefix, command, post) module_string = create_module_string(pre, prefix, command, post)
running_modules_dict[alignment][name] = module_string running_modules_dict[alignment][name] = module_string
print_bar() print_bar()
if refresh == 0:
break
sleep(refresh/1000) sleep(refresh/1000)