From 2e53d28d351f0560e6e56f561b7d7ee674d1bef1 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 14 Mar 2021 11:20:50 +0100 Subject: [PATCH] i3pystatus: parse rfkill output instead of relying on pyric.utils.rfkill --- .config/i3pystatus/rfkill-bt.py | 13 ++++++++++--- .config/i3pystatus/rfkill-wifi.py | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.config/i3pystatus/rfkill-bt.py b/.config/i3pystatus/rfkill-bt.py index 1d5406c..109aa55 100755 --- a/.config/i3pystatus/rfkill-bt.py +++ b/.config/i3pystatus/rfkill-bt.py @@ -1,9 +1,16 @@ #!/usr/bin/python -import pyric.utils.rfkill as rfkill -import sys +from subprocess import check_output -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']: bt = '#FF0000' diff --git a/.config/i3pystatus/rfkill-wifi.py b/.config/i3pystatus/rfkill-wifi.py index 70150d7..29f9b63 100755 --- a/.config/i3pystatus/rfkill-wifi.py +++ b/.config/i3pystatus/rfkill-wifi.py @@ -1,9 +1,16 @@ #!/usr/bin/python -import pyric.utils.rfkill as rfkill -import sys +from subprocess import check_output -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']: wlan = '#FF0000'