15 lines
393 B
Python
15 lines
393 B
Python
import i3ipc
|
|
import sys
|
|
from itertools import zip_longest, count
|
|
|
|
i3 = i3ipc.Connection()
|
|
|
|
workspaces = sorted(int(w.name.split(":")[0]) for w in i3.get_workspaces())
|
|
for i, workspace in zip_longest(count(1), workspaces):
|
|
print(i, workspace, file=sys.stderr)
|
|
if i != workspace:
|
|
print(i)
|
|
break
|
|
else:
|
|
print("no free workspace found", file=sys.stderr)
|
|
sys.exit(1)
|