Open vinayb21 opened 5 years ago
@akosyakov Is there a way to do so by changing the configuration in settings.json ?
no, it is not possible
Which workspace/session do you mean? Theia does not have such notions.
By workspace, I meant the folder that I provided to be launched with Theia. yarn theia start /my-workspace --hostname 0.0.0.0 --port 7000
ok, sorry, thought you meant some cloud workspace. I know that Gitpod is capable of doing snapshot of the user layout and use it as a default on first startup: https://docs.gitpod.io/33_Sharing_and_Collaboration.html#sharing-snapshots
You could do something like that with a custom extension. To get current layout: https://github.com/theia-ide/theia/blob/5956e48a3e9bffccc6f8fc8379ebe23957f43735/packages/core/src/browser/shell/application-shell.ts#L517
I am interested in having a default layout on first startup. I see how my extension can get the layout details but am struggling to find where to load them. Any pointers would be much appreciated.
@ektek You can implement https://github.com/theia-ide/theia/blob/e5c229cf12ceff663d8a00fb97ac161f0922d169/packages/core/src/browser/frontend-application.ts#L70 in custom extension, from there you access views and change their state.
Thank you @akosyakov. One more related question, currently I see how to start an extension through a command. How would an extension automatically start on first load?
How would an extension automatically start on first load?
@ektek What extension do you mean? All native Theia extensions are loaded on startup.
@akosyakov I managed to get the layout saving and loading working, thank you! What I meant was, right now I start my extension by opening it from the menu. Is there a way to automatically start my extension on browser load?
Your extension can implement one of application lifecycle hooks: https://github.com/eclipse-theia/theia/blob/b7cad4848757296facef161635ee656a9be0a5b9/packages/core/src/browser/frontend-application.ts#L32-L76 For example, you can implement in onStart
something which should be done for each new window. Or you can implement initializeLayout
in order only do something for a new windows without previous layout information.
@ektek Could you share the code of your extension please? I am looking for a way to share layouts between browsers. Thanks
You could create a custom extension which does it.