forked from kunsi/dotfiles
i3pystatus/ice-status: only show net info if we actually have information
This commit is contained in:
parent
b295fd359a
commit
bd8c68235e
1 changed files with 14 additions and 4 deletions
|
@ -66,12 +66,22 @@ try:
|
|||
else:
|
||||
next_stop = 'Endstation, bitte Aussteigen'
|
||||
|
||||
print('<span color="#999999">{}km/h</span> > {} <span color="#999999">(Net: {} > [{}] {})</span>'.format(
|
||||
net_current = ice_status['connectivity']['currentState']
|
||||
net_future = ice_status['connectivity']['nextState']
|
||||
|
||||
if net_current not in (None, 'NO_INFO') or net_future not in (None, 'NO_INFO'):
|
||||
net = ' <span color="#999999">(Net: {} > [{}] {})</span>'.format(
|
||||
net_current,
|
||||
format_time(ice_status['connectivity']['remainingTimeSeconds']),
|
||||
net_future,
|
||||
)
|
||||
else:
|
||||
net = ''
|
||||
|
||||
print('<span color="#999999">{}km/h</span> > {}{}'.format(
|
||||
ice_status['speed'],
|
||||
next_stop,
|
||||
ice_status['connectivity']['currentState'],
|
||||
format_time(ice_status['connectivity']['remainingTimeSeconds']),
|
||||
ice_status['connectivity']['nextState'],
|
||||
net,
|
||||
))
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
|
Loading…
Reference in a new issue