frobar: Handle PulseAudio sinks without active port
No idea in which conditions those happen, but apparently they do happen.
This commit is contained in:
parent
d6e95da9dc
commit
3ccb0abfe5
hm/desktop/frobar/frobar
|
@ -531,6 +531,10 @@ class MultiSectionsProvider(Provider):
|
|||
async def getSectionUpdater(self, section: Section) -> typing.Callable:
|
||||
raise NotImplementedError()
|
||||
|
||||
@staticmethod
|
||||
async def doNothing() -> None:
|
||||
pass
|
||||
|
||||
async def updateSections(self, sections: set[Sortable], module: Module) -> None:
|
||||
moduleSections = self.sectionKeys[module]
|
||||
async with asyncio.TaskGroup() as tg:
|
||||
|
|
|
@ -432,7 +432,11 @@ class PulseaudioProvider(
|
|||
|
||||
sink = self.sinks[section.sortKey]
|
||||
|
||||
if (
|
||||
icon = "?"
|
||||
|
||||
if sink.port_active is None:
|
||||
pass
|
||||
elif (
|
||||
sink.port_active.name == "analog-output-headphones"
|
||||
or sink.port_active.description == "Headphones"
|
||||
):
|
||||
|
@ -444,8 +448,6 @@ class PulseaudioProvider(
|
|||
icon = ""
|
||||
elif sink.port_active.name in ("headset-output", "headphone-output"):
|
||||
icon = ""
|
||||
else:
|
||||
icon = "?"
|
||||
|
||||
section.numberStates = 3
|
||||
section.state = 1
|
||||
|
@ -497,9 +499,6 @@ class NetworkProvider(
|
|||
self.time = loop.time()
|
||||
self.io_counters = psutil.net_io_counters(pernic=True)
|
||||
|
||||
async def doNothing(self) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def getIfaceAttributes(iface: str) -> tuple[bool, str, bool]:
|
||||
relevant = True
|
||||
|
|
Loading…
Reference in a new issue