From 4e869e2cf0484a3a59186d6ea3ca4f6e2aee128d Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Fri, 27 Dec 2024 15:30:19 +0100 Subject: [PATCH] fix: formating issues in prompt --- home/status | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/home/status b/home/status index 45e78d8..e24816b 100755 --- a/home/status +++ b/home/status @@ -23,7 +23,7 @@ class Cat(Status): def status(self): cat_width = 200 index = self.index - catwalk = " " * (cat_width - index) + 1 * "🐈🏳️‍🌈" + " " * index + catwalk = "🐈🏳️‍🌈" + " " * index self.index = (index + 1) % cat_width return {"full_text": catwalk} @@ -71,7 +71,17 @@ class Battery(Status): class Time(Status): def status(self): - return {"full_text": datetime.now().strftime("%Vth %A %H:%M") } + now = datetime.now() + match now.isocalendar().week % 10: + case 1: + th = "st" + case 2: + th = "nd" + case 3: + th = "rd" + case _: + th = "th" + return {"full_text": now.strftime(f"%V{th} %A %H:%M") } class FailedUnits(Status): @@ -82,7 +92,7 @@ class FailedUnits(Status): for line in stdout: if 'failed' in line: failed += 1 - if failed is 0: + if failed == 0: return {"full_text": f"No failed units"} else: return {"full_text": f"There are {failed} failed units", "color": "#ff0000"}