How to adjust the configuration of jupyter lab default Context menu

jupyter lab 3.x
How to config jupyterlab default Context menu. such as disabling the copy function

We’ve faced the same issue. Built a UI custom extension to overlay the out of the box UI extension for the menu.

Since JupyterLab 3.3.x most menu items can be customized (including disabling) via settings as described in the documentation (see Common Extension Points — JupyterLab 3.3.2 documentation). Further, you can pass setting overrides using overrides.json file (Advanced Usage — JupyterLab 3.3.2 documentation). Combining the two you can provide users with the selection of menu functions that you like.

@xuoutput
This needs knowing the name of the command and the CSS selector.

Here how you can disable items from the context-menu that deals with files in the file browser using JSON.

you can go the the settings → advanced settings, then select “Application Context Menu”
In the user preferences add the settings you want like this:
This code will disable few items like copy path, copy shareable Link, also Cut Cell in the edit mode
{
“contextMenu”: [
// Disable Copy Shareable Link
{
“command”: “filebrowser:share-main”,
“selector”: “.jp-DirListing-item[data-isdir]”,
“disabled”: true
},
// Disable Copy Path
{
“command”: “filebrowser:copy-path”,
“selector”: “.jp-DirListing-item[data-isdir]”,
“disabled”: true
},
// Disable Copy Download Link
{
“command”: “filebrowser:copy-download-link”,
“selector”: “.jp-DirListing-item[data-isdir="false"]”,
“disabled”: true
},
// Disable Duplicate Item
{
“command”: “filebrowser:duplicate”,
“selector”: “.jp-DirListing-item[data-isdir="false"]”,
“disabled”: true
},
// Disable cut-cell
{
“command”: “notebook:cut-cell”,
“selector”: “.jp-Notebook .jp-Cell”,
“disabled”: true
}
]
}
The commands and selectors come from here https://github.com/jupyterlab/jupyterlab/tree/ac8f9e2f47b271785127757541a6fd8aa10c4d31/packages/filebrowser-extension/schema