i3pystatus: parse rfkill output instead of relying on pyric.utils.rfkill

This commit is contained in:
Franzi 2021-03-14 11:20:50 +01:00
parent 2e05d37c38
commit 2e53d28d35
Signed by untrusted user: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 20 additions and 6 deletions

View file

@ -1,9 +1,16 @@
#!/usr/bin/python #!/usr/bin/python
import pyric.utils.rfkill as rfkill from subprocess import check_output
import sys
devices = rfkill.rfkill_list()
devices = {}
for line in check_output(['rfkill', '-rn']).decode('UTF-8').splitlines():
nr, identifier, device, soft, hard = line.split(' ')
devices[device] = {
'soft': True if soft == 'blocked' else False,
'hard': True if hard == 'blocked' else False,
}
if devices['tpacpi_bluetooth_sw']['hard']: if devices['tpacpi_bluetooth_sw']['hard']:
bt = '#FF0000' bt = '#FF0000'

View file

@ -1,9 +1,16 @@
#!/usr/bin/python #!/usr/bin/python
import pyric.utils.rfkill as rfkill from subprocess import check_output
import sys
devices = rfkill.rfkill_list()
devices = {}
for line in check_output(['rfkill', '-rn']).decode('UTF-8').splitlines():
nr, identifier, device, soft, hard = line.split(' ')
devices[device] = {
'soft': True if soft == 'blocked' else False,
'hard': True if hard == 'blocked' else False,
}
if devices['phy0']['hard']: if devices['phy0']['hard']:
wlan = '#FF0000' wlan = '#FF0000'