#!/usr/bin/python

from subprocess import check_output


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'
elif devices['tpacpi_bluetooth_sw']['soft']:
    bt  = '#FF9900'
else:
    bt  = '#00FF00'

print(f'<span color="{bt}">BT</span>')
