i3pystatus: parse rfkill output instead of relying on pyric.utils.rfkill
This commit is contained in:
parent
2e05d37c38
commit
2e53d28d35
2 changed files with 20 additions and 6 deletions
|
@ -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'
|
||||||
|
|
|
@ -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'
|
||||||
|
|
Loading…
Reference in a new issue