From 6ed384671e51841c32b9f632605f06822e118806 Mon Sep 17 00:00:00 2001 From: abxh <83485102+abxh@users.noreply.github.com> Date: Tue, 19 Apr 2022 05:01:27 +0000 Subject: [PATCH] check if icon_count is not 0 If the number of icons is 0 i. e. there are no windows in a workspace, then, assuming parts["shortname"] is None, ": " is appended to string. The following edit fixes that small issue, but also adds ":" to string, if parts["shortname"] is not None. --- contrib/autoname-workspaces.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/autoname-workspaces.py b/contrib/autoname-workspaces.py index 3ec399280..85eb19961 100755 --- a/contrib/autoname-workspaces.py +++ b/contrib/autoname-workspaces.py @@ -68,15 +68,18 @@ def parse_workspace_name(name): 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 or parts["shortname"]: + 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 + return new_name if __name__ == "__main__":