I'm developing a plugin to save different sessions in Sublime Text 2. The idea of "saving a session" is to (in some way) save all the currently opened windows and its contents to a file. Then, to load a session you just need to load that file.
This plugin is quite easy to develop for one window: To save the current window, just save the content (file name, for example) of all its views. To load, just close all views and open a view for each file specified in the session file.
The problem comes when I want to save/load more than one window. I cannot find a way to close windows that are not the active one, and I also cannot open new windows programatically... I'm managing several options:
Save the info of the current windows in a file (for each window, save all its views. This should be enough)
Just serialize (pickle) the content of sublime.windows(), and load it when loading a session
Either modify or create several Session.sublime_session files and load/save
Any of this options seems to be valid, however as I said before, I cannot find a way to programatically open/close new windows. Can anyone help me please?
Thanks a lot!