dotfiles/config/i3/compact.py
2020-03-04 13:27:36 +01:00

11 lines
330 B
Python

import i3ipc
import sys
from itertools import zip_longest, count
i3 = i3ipc.Connection()
workspaces = (w.name for w in i3.get_workspaces())
for i, workspace in zip(count(1), workspaces):
name = workspace.split(":", 1)[-1]
i3.command(f"rename workspace '{workspace}' to '{i}:{name}'")
print(i, name, file=sys.stderr)