How to add "Open with Code" with right-click in Ubuntu or Pop OS?

Viewed 4250

In windows OS, when we install VS-Code, the option to add "open with code" is offered to us. But I couldn't find it in Ubuntu or Pop-OS! Thus, I'd like to know, is there any way I can add "open with code" when I right-click within a folder to open the folder in VS-Code?

Although, we can use a terminal for opening the directory in VS-Code using "code ." but I'm looking for the right-click of the mouse.

2 Answers

You could manually write down MIME types associated with vscode in ~/.local/share/applications/mimeapps.list like this

[Added Associations]
text/html=code.desktop
text/css=code.desktop
text/javascript=code.desktop

Assuming you have a proper Desktop Entry inside /usr/share/applications/


You can also try this Nautilus extension (if you use Nautilus)

https://github.com/harry-cpp/code-nautilus

This will install it if you use bash

wget -qO- https://raw.githubusercontent.com/harry-cpp/code-nautilus/master/install.sh | bash

You can run this command in the terminal

wget -qO- https://raw.githubusercontent.com/cra0zy/code-nautilus/master/install.sh | bash

After that you'll see on right click 'Open in Code'!

Works perfectly in Ubuntu 20.04

Related