Advertisement
Guest User

i3wm empty workspaces

a guest
Oct 21st, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import json
  4. import subprocess
  5. import time
  6.  
  7.  
  8. def i3_msg(args):
  9.     return json.loads(subprocess.check_output(["i3-msg"] + args))
  10.  
  11.  
  12. def main():
  13.     outputs = i3_msg(["-t", "get_outputs"])
  14.     spaces = i3_msg(["-t", "get_workspaces"])
  15.     next_space = max([space['num'] for space in spaces])
  16.     for output in outputs:
  17.         if output['active']:
  18.             next_space += 1
  19.             i3_msg(["workspace", str(output['current_workspace'])])
  20.             i3_msg(["workspace", str(next_space)])
  21.  
  22.  
  23. if __name__ == '__main__':
  24.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement