From af3ba1dd57e056f3fca8c771e5105362bfe58641 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 1 Aug 2021 18:02:34 +0200 Subject: [PATCH] i3-companion: simplify workspace duplicate renames It seems we can initialize a lock without having a loop. --- bin/i3-companion | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/i3-companion b/bin/i3-companion index 2f02576..2601339 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -347,12 +347,10 @@ async def new_workspace(i3, event): @on(I3Event.WORKSPACE_INIT) -@static(lock=None) +@static(lock=asyncio.Lock()) async def workspace_rename_duplicate(i3, event): """Rename a workspace when initialized empty with a duplicate number.""" # This will not be needed once https://github.com/i3/i3/pull/4252 is released. - if workspace_rename_duplicate.lock is None: - workspace_rename_duplicate.lock = asyncio.Lock() async with workspace_rename_duplicate.lock: workspace = event.current workspaces = await i3.get_workspaces()