reworked generate_text() and fixed spacing bug

This commit is contained in:
Noah Swerhun 2023-03-15 20:44:29 -05:00
parent cde7b1af0d
commit 71bfac1b53

View file

@ -84,12 +84,11 @@ class Module:
self.post += "%{A}"
def generate_text(self):
text = self.pre + self.padding + self.prefix
if self.signal != 0:
text += "(" + str(self.signal) + ")"
text += run(self.command, shell=True, capture_output=True, text=True).stdout.strip()
text += self.padding + self.post
self.text = text
command_output = run(self.command, shell=True, capture_output=True, text=True).stdout.strip()
if len(command_output) == 0:
self.text = ""
else:
self.text = self.pre + self.padding + self.prefix + command_output + self.padding + self.post
def thread_callback(self):
while True: