feat(autoname-workspace) Add option to remove trailing whitespace

This commit is contained in:
hxr404 2022-06-06 03:23:44 +02:00
parent a7ec761da4
commit c17d6355b1
No known key found for this signature in database
GPG key ID: 265128F293C877D7

View file

@ -45,7 +45,7 @@ def rename_workspaces(ipc):
continue continue
icon_tuple += (icon,) icon_tuple += (icon,)
name_parts["icons"] = " ".join(icon_tuple) name_parts["icons"] = " ".join(icon_tuple)
if name_parts["icons"]: if not ARGUMENTS.remove_whitespace and name_parts["icons"]:
name_parts["icons"] += " " name_parts["icons"] += " "
new_name = construct_workspace_name(name_parts) new_name = construct_workspace_name(name_parts)
ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name)) ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name))
@ -98,6 +98,12 @@ if __name__ == "__main__":
default="/tmp/sway-autoname-workspaces.log", default="/tmp/sway-autoname-workspaces.log",
help="Path for the logfile.", help="Path for the logfile.",
) )
parser.add_argument(
"-rw",
"--remove-whitespace",
action="store_true",
help="Set it to remove the trailing whitespace after the icons in the workspace's name."
)
args = parser.parse_args() args = parser.parse_args()
global ARGUMENTS global ARGUMENTS
ARGUMENTS = args ARGUMENTS = args