You are not logged in.

#1 2021-10-04 00:42:52

mongoose088
Member
Registered: 2008-09-14
Posts: 32

[SOLVED] Determine bluetooth radio status on i3status bar

Hello everyone,

I am trying to setup my i3status bar to show whether my bluetooth module is turned on or off.

"tlp-stat -r" seems to display this information nicely:

--- TLP 1.4.0 --------------------------------------------

+++ Wireless
bluetooth = off (software)
wifi      = on
wwan      = none (no device)

wlp4s0(iwlwifi)               : wifi, connected, power management = on

I want to understand where TLP is collecting this information from. For example, if I type in:

	 cat /sys/class/net/wlp4s0/operstate 

It will return the word "up". But I don't have anything like that for bluetooth in the "net" folder, only my ethernet and wifi. I also tried looking in /sys/class/bluetooth/ folder, but it was an empty directory.

My goal is to find a location that returns a simple "on" or "off" status to pipe that into my i3 status bar, the same way tlp-stat seems to "know". Where would that location be?

EDIT: Solved. The command to use is rfkill, the proper column can be extracted with awk.

    bt_status = $(rfkill -n -o device,soft | awk '/bluetooth/ {print $2}')

Last edited by mongoose088 (2021-10-08 19:44:06)

Offline

Board footer

Powered by FluxBB