i3pystatus: fix wifi device detection

This commit is contained in:
Franzi 2022-03-06 18:05:56 +01:00
parent b170187208
commit b295fd359a
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -12,11 +12,20 @@ for line in check_output(['rfkill', '-rn']).decode('UTF-8').splitlines():
'hard': True if hard == 'blocked' else False,
}
if devices['phy0']['hard']:
wlan = '#FF0000'
elif devices['phy0']['soft']:
wlan = '#FF9900'
else:
wlan = '#00FF00'
wifi_dev = None
for device in devices:
if device.startswith('phy'):
wifi_dev = device
break
print(f'<span color="{wlan}">WLAN</span>')
if not wifi_dev:
print('No WLAN?')
else:
if devices[wifi_dev]['hard']:
wlan = '#FF0000'
elif devices[wifi_dev]['soft']:
wlan = '#FF9900'
else:
wlan = '#00FF00'
print(f'<span color="{wlan}">WLAN</span>')