From 2c60a28c16b760605ce04c6a4ccf4c18cb31bf25 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 11 Oct 2021 21:04:56 +0200 Subject: [PATCH] i3pystatus: some ice-status improvements --- .config/i3pystatus/config.py | 2 ++ .config/i3pystatus/ice-status.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.config/i3pystatus/config.py b/.config/i3pystatus/config.py index 1622c7f..ac02e9d 100644 --- a/.config/i3pystatus/config.py +++ b/.config/i3pystatus/config.py @@ -98,7 +98,9 @@ status.register("shell", status.register("shell", format="{output}", + hints = {"markup": "pango"}, command="/home/kunsi/.config/i3pystatus/ice-status.py", + ignore_empty_stdout=True, interval=2) status.register("network", diff --git a/.config/i3pystatus/ice-status.py b/.config/i3pystatus/ice-status.py index 46d6d46..0102911 100755 --- a/.config/i3pystatus/ice-status.py +++ b/.config/i3pystatus/ice-status.py @@ -7,7 +7,7 @@ from sys import exit # bundlewrap.utils.text.format_duration, but trimmed down -def format_time(seconds, with_seconds=True): +def format_time(seconds): components = [] if seconds >= 3600: hours = int(seconds / 3600) @@ -17,8 +17,8 @@ def format_time(seconds, with_seconds=True): minutes = int(seconds / 60) seconds -= minutes * 60 components.append('{}m'.format(minutes)) - if (seconds > 0 and with_seconds) or not components: - components.append('{}s'.format(seconds)) + if not components: + components.append('now') return " ".join(components) @@ -56,7 +56,7 @@ try: stop['station']['name'], stop['track']['actual'], arrival.strftime('%H:%M'), - format_time(arrival_in.total_seconds(), False), + format_time(arrival_in.total_seconds()), delay ) break