dotfiles/config/i3/compact.py

12 lines
330 B
Python
Raw Normal View History

2020-03-04 12:27:36 +00:00
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)