frobar: Workaround missing workspace

Not sure what causes it, not interested in figuring out right now.
This commit is contained in:
Geoffrey Frogeye 2025-01-26 17:18:11 +01:00
parent 3335f90de4
commit 460ab8938f
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -19,7 +19,7 @@ from frobar.common import (AlertingProvider, Button, MirrorProvider, Module,
MultiSectionsProvider, PeriodicProvider,
PeriodicStatefulProvider, Screen, Section,
SingleSectionProvider, StatefulSection,
StatefulSectionProvider, clip, humanSize, ramp)
StatefulSectionProvider, clip, humanSize, log, ramp)
gi.require_version("Playerctl", "2.0")
import gi.repository.Playerctl
@ -81,7 +81,12 @@ class I3WorkspacesProvider(MultiSectionsProvider):
section.setAction(Button.CLICK_LEFT, switch_to_workspace)
async def update() -> None:
workspace = self.workspaces[num]
workspace = self.workspaces.get(num)
if workspace is None:
log.warning(f"Can't find workspace {num}")
section.setText("X")
return
name = workspace.name
if workspace.urgent:
section.color = self.COLOR_URGENT