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}" self.post += "%{A}"
def generate_text(self): def generate_text(self):
text = self.pre + self.padding + self.prefix command_output = run(self.command, shell=True, capture_output=True, text=True).stdout.strip()
if self.signal != 0: if len(command_output) == 0:
text += "(" + str(self.signal) + ")" self.text = ""
text += run(self.command, shell=True, capture_output=True, text=True).stdout.strip() else:
text += self.padding + self.post self.text = self.pre + self.padding + self.prefix + command_output + self.padding + self.post
self.text = text
def thread_callback(self): def thread_callback(self):
while True: while True: