How to disable open new terminal command from quick open widget?

I have written to hide the menu option of the terminal from the UI but from quick open modal(Ctrl+Shift+p), I can able to open a new terminal. So can you help me how to restrict that.

It is not just restricted to open a new terminal but for all the option which I want to hide from the UI, I want to restrict the same from quick open widget.

[original thread by satya-dash]

You need to override https://github.com/theia-ide/theia/blob/55bf443b534a587ce78d3fda4083a410fe6027b0/packages/terminal/src/browser/terminal-quick-open-service.ts#L164

@satya-dash are you attempting to remove the menu and command for New Terminal?

[satya-dash]

@vince-fugnitto Yes. Need to trigger that from different menu.

you can always remove it from a menu, and add it to a different menu item if you’d like

when registering your menu action, you can reference the original NEW.id command from the TerminalCommands namespace

How to disable Terminal from the Main menu ?

Disable or remove? If you want to remove it, here is an example: https://github.com/eclipse-theia/theia/issues/8175#issuecomment-658712407

If you want to disable it, I would recommend un-registering the command, and re-register it with the same ID, but different isEnabled implementation of the corresponding command handler. I have not tried it but should work.

Note, in electron, all menus are enabled: https://github.com/eclipse-theia/theia/issues/446

what is the ID or Command for Terminal ?
So that I can unregister it.

I get the below error in browser.
bundle.js:57889 Error: Ambiguous match found for serviceIdentifier: WorkspaceFrontendContribution

The ID is terminal:new.

This is the my workflow figuring out what the ID is:

I hope this helps.

2 Likes

Thanks @kittaakos. It really helped alot.