diff options
Diffstat (limited to '')
-rwxr-xr-x | .i3/scripts/new_workspace.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.i3/scripts/new_workspace.py b/.i3/scripts/new_workspace.py new file mode 100755 index 0000000..cfb73d1 --- /dev/null +++ b/.i3/scripts/new_workspace.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +# +# Switch to a new workspace, which gets the first free numbe >= 0 +# + +import sys +from os.path import realpath, dirname + +cwd = realpath(dirname(__file__)) +sys.path.insert(1, cwd) + +import i3 + +nums = (w["num"] for w in i3.get_workspaces()) +nums = filter(lambda n: n is not None and n >= 0, nums) + +for i,n in enumerate(sorted(nums)): + if i != n: + i3.workspace(str(i)) + break +else: + i3.workspace(str(i+1)) |