Executing action on filebrowser change

I’m trying to create an extension that hides the filebrowser toolbar while in a specific directory. I’ve figured out how to hide the toolbar itself, but haven’t been able to make it happen when the active directory of the filebrowser changes. Any help would be greatly appreciated!