Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # cycle-workspace
  4. # Moves the currently active workspace to the next active display
  5. # Depends on i3-py (`pip install i3-py`)
  6.  
  7. import i3
  8.  
  9. # figure out what is on, and what is currently on your screen.
  10. focused_workspace = list(filter(lambda s: s['focused'],
  11. i3.get_workspaces()))[0]
  12. outputs = list(filter(lambda s: s['active'], i3.get_outputs()))
  13.  
  14. # find the index of the currently focused workspace
  15. currentIndex = 0
  16. for i, output in enumerate(outputs):
  17. if output['name'] == focused_workspace['output']:
  18. currentIndex = i
  19. break
  20.  
  21. # find the next workspace
  22. nextIndex = currentIndex + 1
  23. if nextIndex >= len(outputs):
  24. nextIndex = 0
  25. other_workspace = outputs[nextIndex]
  26.  
  27. # send current to the no-active one
  28. i3.command('move', 'workspace to output '+other_workspace['name'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement