mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-28 04:20:03 +02:00
i3-companion: fix bluetooth on/off
This commit is contained in:
parent
fc3563777a
commit
a5e5b23ec8
1 changed files with 30 additions and 30 deletions
|
@ -658,39 +658,39 @@ async def bluetooth_status(i3, event, *args):
|
||||||
major = (device_class & 0x1F00) >> 8
|
major = (device_class & 0x1F00) >> 8
|
||||||
minor = (device_class & 0xFC) >> 2
|
minor = (device_class & 0xFC) >> 2
|
||||||
devices.append((major, minor))
|
devices.append((major, minor))
|
||||||
if not powered:
|
|
||||||
polybar("bluetooth", "")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Generate output
|
# Generate output
|
||||||
# See: https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers/Assigned%20Number%20Types/Baseband.pdf
|
# See: https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers/Assigned%20Number%20Types/Baseband.pdf
|
||||||
output = [icons["bluetooth"]]
|
if not powered:
|
||||||
for major, minor in devices:
|
output = ""
|
||||||
if major == 1:
|
else:
|
||||||
output.append(icons["laptop"])
|
output = [icons["bluetooth"]]
|
||||||
elif major == 2:
|
for major, minor in devices:
|
||||||
output.append(icons["phone"])
|
if major == 1:
|
||||||
elif major == 3:
|
output.append(icons["laptop"])
|
||||||
output.append(icons["access-point"])
|
elif major == 2:
|
||||||
elif major == 4 and minor in {1, 2}:
|
output.append(icons["phone"])
|
||||||
output.append(icons["headset"])
|
elif major == 3:
|
||||||
elif major == 4 and minor == 4:
|
output.append(icons["access-point"])
|
||||||
output.append(icons["microphone"])
|
elif major == 4 and minor in {1, 2}:
|
||||||
elif major == 4 and minor in {5, 7, 10}:
|
output.append(icons["headset"])
|
||||||
output.append(icons["loudspeaker"])
|
elif major == 4 and minor == 4:
|
||||||
elif major == 4 and minor == 6:
|
output.append(icons["microphone"])
|
||||||
output.append(icons["headphones"])
|
elif major == 4 and minor in {5, 7, 10}:
|
||||||
elif major == 4 and minor == 8:
|
output.append(icons["loudspeaker"])
|
||||||
output.append(icons["car"])
|
elif major == 4 and minor == 6:
|
||||||
elif major == 5 and minor in {1, 2}:
|
output.append(icons["headphones"])
|
||||||
output.append(icons["gamepad"])
|
elif major == 4 and minor == 8:
|
||||||
elif major == 5 and minor & 0x10:
|
output.append(icons["car"])
|
||||||
output.append(icons["keyboard"])
|
elif major == 5 and minor in {1, 2}:
|
||||||
elif major == 5 and minor & 0x20:
|
output.append(icons["gamepad"])
|
||||||
output.append(icons["mouse"])
|
elif major == 5 and minor & 0x10:
|
||||||
else:
|
output.append(icons["keyboard"])
|
||||||
output.append(icons["unknown"])
|
elif major == 5 and minor & 0x20:
|
||||||
output = "|".join(output)
|
output.append(icons["mouse"])
|
||||||
|
else:
|
||||||
|
output.append(icons["unknown"])
|
||||||
|
output = "|".join(output)
|
||||||
|
|
||||||
# Update polybar
|
# Update polybar
|
||||||
if bluetooth_status.last != output:
|
if bluetooth_status.last != output:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue