i3-companion: let @retry decorator handle exception for battery

This commit is contained in:
Vincent Bernat 2022-03-29 07:56:02 +02:00
parent f439a62b1c
commit fcd75c38b4

View file

@ -834,7 +834,6 @@ async def bluetooth_status(i3, event, *args):
# from PA 16, it may be exposed by PA, then to BlueZ. # from PA 16, it may be exposed by PA, then to BlueZ.
# See # See
# https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482 # https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482
try:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
sock = socket.socket( sock = socket.socket(
socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM
@ -861,8 +860,7 @@ async def bluetooth_status(i3, event, *args):
# Choose an icon # Choose an icon
icon = f"battery-{(battery+12)//25*25}" icon = f"battery-{(battery+12)//25*25}"
output[-1] = (output[-1], icon) output[-1] = (output[-1], icon)
except Exception as exc:
logger.info("cannot get battery status: %s", exc)
# Schedule a refresh in 5 minutes # Schedule a refresh in 5 minutes
bluetooth_status.scheduled = loop.call_later( bluetooth_status.scheduled = loop.call_later(
600, 600,