From fbac7a31541eb4f8a6a9d6870396d13b15d8080f Mon Sep 17 00:00:00 2001 From: abxh <83485102+abxh@users.noreply.github.com> Date: Tue, 19 Apr 2022 04:09:04 +0000 Subject: [PATCH] don't add ": " to new_name, if icon_count is 0. Don't add ": " to new_name, if icon_count is 0. Otherwise exiting all windows in a workspace does not remove ": " from new_name. --- contrib/autoname-workspaces.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/autoname-workspaces.py b/contrib/autoname-workspaces.py index 3ec399280..337cae352 100755 --- a/contrib/autoname-workspaces.py +++ b/contrib/autoname-workspaces.py @@ -64,16 +64,18 @@ def parse_workspace_name(name): "(?P[0-9]+):?(?P\w+)? ?(?P.+)?", name ).groupdict() - def construct_workspace_name(parts): new_name = str(parts["num"]) if parts["shortname"] or parts["icons"]: - new_name += ":" + icon_count=len(parts["icons"].split()) + + if icon_count != 0: + new_name += ":" if parts["shortname"]: new_name += parts["shortname"] - if parts["icons"]: + if parts["icons"] and icon_count != 0: new_name += " " + parts["icons"] return new_name