aboutsummaryrefslogtreecommitdiff
path: root/scripts/.scripts/cycle-workspace.py
blob: 7f176db85ae14b8ed5766783b14dec726df5ab17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
#https://gist.github.com/97-109-107/b70356670ae8309ffb4f
 
import i3

outputs = i3.get_outputs()
workspaces = i3.get_workspaces()

# figure out what is on, and what is currently on your screen.
workspace = list(filter(lambda s: s['focused']==True, workspaces))
output = list(filter(lambda s: s['active']==True, outputs))

# figure out the other workspace name
other_workspace = list(filter(lambda s: s['name']!=workspace[0]['output'], output))



# send current to the no-active one
i3.command('move', 'workspace to output '+other_workspace[0]['name'])



#print(str(list(filter(lambda s: s['active']==True, workspaces))))

i3.command('workspace', other_workspace[0]['current_workspace'])
i3.command('move', 'workspace to output '+workspace[0]['output'])