mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-08 01:04:21 +02:00
i3-companion: handle absence of Bluetooth class on a device
This seems to happen on first pairing.
This commit is contained in:
parent
f128c10012
commit
3f915404a8
1 changed files with 7 additions and 4 deletions
|
@ -765,10 +765,13 @@ async def bluetooth_status(i3, event, *args):
|
||||||
device = interfaces["org.bluez.Device1"]
|
device = interfaces["org.bluez.Device1"]
|
||||||
if not device["Connected"][1]:
|
if not device["Connected"][1]:
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
device_class = device["Class"][1]
|
device_class = device["Class"][1]
|
||||||
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))
|
||||||
|
except KeyError:
|
||||||
|
devices.append((0, 0))
|
||||||
|
|
||||||
# Choose appropriate icons for output
|
# Choose appropriate icons for output
|
||||||
# See: https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers
|
# See: https://btprodspecificationrefs.blob.core.windows.net/assigned-numbers
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue