Created
October 16, 2022 00:17
-
-
Save neilbags/b95a74b879b1bda260a8b5f00f7c383b to your computer and use it in GitHub Desktop.
Move i3 container to next empty workspace, and follow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import json, subprocess | |
output = subprocess.check_output(['i3-msg', '-t', 'get_workspaces']) | |
workspaces = json.loads(output) | |
next_num = next(i for i in range(1, 100) if not [ws for ws in workspaces if ws['num'] == i]) | |
subprocess.call(['i3-msg', f'move container to workspace number {next_num}; workspace {next_num}']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment