How to close the left sidebar in a jupyterlab extension

Hi, I am new to the jupyterlab extension development, I am trying to open/close the left sidebar (the file browser) pragmatically. Could you please give me some hint on how to implement that in a jupyterlab extension? I have been searching through the jupyterlab repo but doesn’t seem to find anything for that.

The command application:toggle-left-area will do what is says on the tin:


The above link also shows how one might ensure that it only opens, by looking at

Thanks a lot! It works!