From 460ab8938fc3d2de114db294ec9ae71d6987a237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 26 Jan 2025 17:18:11 +0100 Subject: [PATCH] frobar: Workaround missing workspace Not sure what causes it, not interested in figuring out right now. --- hm/desktop/frobar/frobar/providers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hm/desktop/frobar/frobar/providers.py b/hm/desktop/frobar/frobar/providers.py index 7e896c5..00554d1 100644 --- a/hm/desktop/frobar/frobar/providers.py +++ b/hm/desktop/frobar/frobar/providers.py @@ -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