1

I want to know is there a way to add an option "Open in VS Code" for Right Clicking a folder in Ubuntu 20 (Focal Fossa). I know its possible for a file using Nautilus but is it possible for a folder?

context_menu_screenshot

Dan
  • 14,180

2 Answers2

0

Add inode/directory; to the .desktop launcher of the application to have it also appear in the right-click "Open with other application" item for a folder.

vanadium
  • 97,564
0

The answer is Exclusively for xfce user. So it can be Xubuntu or mint-22 xfce

Xfce user generally wants to configure the commands by themselves rather cloning any github command. To enable Open In code option in context menu follow the below instruction.

  1. Open Thunar and go to Edit > Configure Custom Actions...
  2. Click the + button. This will open a new window containing two tab Basic and Appearance Conditions.
  3. In Basic
    1. Add the name i.e. "Open in Code"
    2. Add Description i.e. "Open the folder in visual studio code"
    3. Command bash -c 'if [ -d "%f" ]; then code "%f"; else code "%f"; fi'
    4. Optionally you can add shortcut i.e. Shift+O
    5. Click on the Icon's "No Icon" and it will open a tab to select Icon "If your vscode is downloaded which I presume is then you will find the vscode Icon"
  4. In Appearance Conditions tab
    1. File Pattern -> *
    2. Range(min-max) -> *
    3. Appears if selection contains: check Directories**, Text Files, Other Files

Your end results should look like this,

enter image description here

enter image description here