Skip to content

Instantly share code, notes, and snippets.

@mrichar1
Last active April 4, 2017 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrichar1/65e3fa3051f257bf80826f587ee48371 to your computer and use it in GitHub Desktop.
Save mrichar1/65e3fa3051f257bf80826f587ee48371 to your computer and use it in GitHub Desktop.
"""Script to launch the specified command in the next available workspace."""
import i3ipc
import sys
# Potential workspaces to use
WORKSPACES = set((1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
def main():
i3c = i3ipc.Connection()
active_ws = set([x['num'] for x in i3c.get_workspaces()])
i3c.command('workspace number {}'.format(WORKSPACES.difference(active_ws).pop()))
i3c.command('exec {}'.format(sys.argv[1]))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment