Sublime Forum

ST3: how to tell if file closed by user vs sublime exit

#1

Hi

How can tell whether a view is being closed by user (^w or click on close button or even file > close all files) versus sublime being shut down. Either case triggers EventListener on_close but I need to distinguish between the two. Is this possible?

Thanks

0 Likes

#2

I think that there is no way to tell. However, a similar question was asked recently, which may be helpful:

there is an outstanding feature request for a callback on application/window close here:

0 Likes

#3

Currently, your only way is to launch a child process that checks whether its parent still exists and performs actions when it doesn’t, after which it terminates itself.

2 Likes