Sublime Forum

EventListener for on project close



I am developing a plugin where I need to change some variables when the user closes or switches the current project.

Something similar to the below code for view change, but for projects:

class ▇▇▇ EventListener(sublime_plugin.EventListener):

	def on_activated(self,view):

Thanks for any input :slight_smile:.



on_pre_close_project tells you when a project in a window is about to be closed; on_load_project will tell you when a project is loading in a window.

That would be the two core operations that let you know that a project is switching, though based on your description you probably want all handling in on_pre_close_project because then you’d know both when a project is closing and also when someone is switching (since presumably the current project has to close before the new one can load).

1 Like


Thanks @OdatNurd !

Exactly what I wanted.