Skip to content

Instantly share code, notes, and snippets.

@roman-yagodin
Last active July 30, 2021 10:38
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save roman-yagodin/9d4ad8a99d5b7649b66f to your computer and use it in GitHub Desktop.
Save roman-yagodin/9d4ad8a99d5b7649b66f to your computer and use it in GitHub Desktop.
Nemo action to open folder in VSCode (somewhat obsolete)
[Nemo Action]
# https://wiki.archlinux.org/index.php/Nemo
# https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action
Name=Open in VS Code
Name[ru]=Открыть в VS Code
Comment=Open current folder in Visual Studio Code
Comment[ru]=Открыть текущую папку в Visual Studio Code
Icon-Name=com.visualstudio.code
Selection=none
Extensions=any;
#Quote=double
EscapeSpaces=true
Exec=code %P
Dependencies=code;
[Nemo Action]
# https://wiki.archlinux.org/index.php/Nemo
# https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action
Name=Open in VS Code
Name[ru]=Открыть в VS Code
Comment=Open selected folder in Visual Studio Code
Comment[ru]=Открыть выбранную папку в Visual Studio Code
Icon-Name=com.visualstudio.code
Selection=s
Extensions=dir;
#Quote=double
EscapeSpaces=true
Exec=code %P/%f
Dependencies=code;
@josephseraos
Copy link

Where should I put the VS Code Icon to Nemo see it?

@roman-yagodin
Copy link
Author

roman-yagodin commented Sep 23, 2019

It should be placed under ~/.local/share/nemo/actions. Note that the code is old - I think I should post a newer version.

Answered wrong question at first, sorry! The custom icon should be placed in ~/.local/share/icons (or, globally, in the /usr/share/icons).

@coppolat1
Copy link

The icon wouldn't load for me. I took a look in /usr/share/applications/code.desktop to see how it referenced the icon. I changed the line:
Icon-Name=code to Icon-Name=com.visualstudio.code and it worked!

@roman-yagodin
Copy link
Author

roman-yagodin commented Nov 1, 2019

It could be also visual-studio-code or visual-studio-code-insiders for Insiders build right now.

I should also note that where is no real need to have Nemo action to open folder in VSCode now, as it is already a recommended application to open folders:

From the /usr/share/applications/code.desktop:

MimeType=text/plain;inode/directory;

@coppolat1
Copy link

You're right I didn't think of that. Although it is an extra click (or hover) to get to it: Right Click on a folder -> Open With -> Visual Studio Code If you check out my fork, I also added another nemo action so that you can right click in a directory and it will open that directory as a folder in VSCode.

@roman-yagodin
Copy link
Author

roman-yagodin commented Nov 1, 2019

Yes, two actions would be better for this case, than just one - currently there is no way to combine different types of selections in one action, AFAIK.

Updated gist, also simplified Exec lines - looks like /bin/sh part is not necessary now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment