forked from kunsi/dotfiles
i3pystatus: fix wifi device detection
This commit is contained in:
parent
b170187208
commit
b295fd359a
1 changed files with 16 additions and 7 deletions
|
@ -12,11 +12,20 @@ for line in check_output(['rfkill', '-rn']).decode('UTF-8').splitlines():
|
||||||
'hard': True if hard == 'blocked' else False,
|
'hard': True if hard == 'blocked' else False,
|
||||||
}
|
}
|
||||||
|
|
||||||
if devices['phy0']['hard']:
|
wifi_dev = None
|
||||||
wlan = '#FF0000'
|
for device in devices:
|
||||||
elif devices['phy0']['soft']:
|
if device.startswith('phy'):
|
||||||
wlan = '#FF9900'
|
wifi_dev = device
|
||||||
|
break
|
||||||
|
|
||||||
|
if not wifi_dev:
|
||||||
|
print('No WLAN?')
|
||||||
else:
|
else:
|
||||||
|
if devices[wifi_dev]['hard']:
|
||||||
|
wlan = '#FF0000'
|
||||||
|
elif devices[wifi_dev]['soft']:
|
||||||
|
wlan = '#FF9900'
|
||||||
|
else:
|
||||||
wlan = '#00FF00'
|
wlan = '#00FF00'
|
||||||
|
|
||||||
print(f'<span color="{wlan}">WLAN</span>')
|
print(f'<span color="{wlan}">WLAN</span>')
|
||||||
|
|
Loading…
Reference in a new issue