Skip to content

Instantly share code, notes, and snippets.

@debovema
Forked from drochgenius/frontend-contribution.ts
Created October 21, 2021 07:13
Show Gist options
  • Save debovema/4e2945425b2436031c693a7514012e2e to your computer and use it in GitHub Desktop.
Save debovema/4e2945425b2436031c693a7514012e2e to your computer and use it in GitHub Desktop.
Hide unused activity bar icons (view container icons)
import { injectable } from 'inversify';
import { FrontendApplicationContribution, FrontendApplication } from '@theia/core/lib/browser';
import { MaybePromise } from '@theia/core/lib/common/types';
import { Widget } from '@theia/core/lib/browser/widgets';
@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<void> {
// Remove unused widgets
app.shell.widgets.forEach((widget: Widget) => {
if (['search-in-workspace', 'explorer-view-container', 'scm-view-container', 'scm-view'].includes(widget.id) || widget.id.startsWith('debug')) {
widget.dispose();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment