i3pystatus: some ice-status improvements

This commit is contained in:
Franzi 2021-10-11 21:04:56 +02:00
parent 24c0b05cf4
commit 2c60a28c16
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 6 additions and 4 deletions

View file

@ -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",

View file

@ -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