Sublime Forum

Load events

#1

Hi guys,

Hopefully I’m just blind and I can’t see something obvious from the API, but is there a way to be notified when a project / folder gets opened? The callbacks seem to be very view centric.

Thanks!

0 Likes

#2

Nothing for project which is what I am looking for to be added to the API. Unfortunately I haven’t seen any official word if they plan on doing this. :cry:

0 Likes

#3

sublimetext.com/docs/3/api_reference.html

Redirect “current file has changed” events (on_new, on_load, on_activated - make sure to use the async ones) to a function to see if window.project_file_name() has changed. You should remember the project filename separately for each window.id().

You can also check window.folders(), but you might need to do this on a timer. Checking asynchronously every 50-250ms shouldn’t hurt performance and will still seem pretty responsive. You should also see if adding a folder triggers a settings on_change listener anywhere.

0 Likes