I’ve search this site for answers, but suggested solutions are not clear for me and I can’t figure it out.
I need to remove some UI elements from Theia (remove marked in orange).
Main top bar,
Git extension and button,
Settings,
Lower left branch change
@injectable()
export class ExampleFrontendContribution implements FrontendApplicationContribution {
/*
* Called after the application shell has been attached in case there is no previous workbench layout state.
* Should return a promise if it runs asynchronously.
*/
onDidInitializeLayout(app: FrontendApplication): MaybePromise {
// Remove unused widgets
app.shell.widgets.forEach((widget: Widget) => {
@maciejchmura thank you for the discussion and welcome to the community
In order to provide any customizations to the framework, and modify any default behavior, a custom extension would be required. From the extension you can extend classes which provide functionality, and override any methods as necessary.
For example, the top-panel is contributed by the ApplicationShell. For a simple solution, you can simply extend the ApplicationShell and hide the top-panel if you no longer require it.
I have a working example if you’d like a reference:
You can use this example to support more advanced use-cases if you want Please also note that we should have native support for toggling the top-panel soon: https://github.com/eclipse-theia/theia/pull/9830
WOW!
Thank you @vince-fugnitto it works!
I removed the top bar.
I will follow your guide to make more UI adjustments.
After some feedback with my PO, I also need to remove completely the whole left section and move the debug panel to the bottom space.
@maciejchmura for the debug-view, you’ll likely want to extend DebugFrontendApplicationContribution and provide a update to the defaultWidgetOptions when creating the widget (area: 'bottom'):
Note that this will not prevent users from moving the view around but if your use-case is to show the debug view at the bottom then it should be sufficient. Else, you can think about extending openView as to only ever open widgets in areas you want, and not the sidepanels.
@maciejchmura It doesn’t seem to be possible to extend the DebugFrontendApplicationContribution constructor, as it accepts no arguments. However, going the other direction (overriding openView) is not possible as well, as AbstractViewContribution is not a component but inherited by different other component, making it impossible to rebind on a global scope.
I assume the best idea would be to change the desired widget area in-place in the application shell. Overriding that should be fairly easy:
@maciejchmura This seems to be unrelated to your changes. For some reason your TypeScript setup wants to recompile the Theia sources. This shouldn’t be necessary. Your tsconfig.json file should usually exclude node_modules directories.
@Abhay0294, I’m not totally sure what you’re trying to accomplish. Can you open a new thread with a bit more context what you’re trying to do and what doesn’t work as expected?