Skip to content

Instantly share code, notes, and snippets.

@harry-cpp
Last active November 17, 2023 16:21
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save harry-cpp/f8ec780e16201f81ccd5234856546414 to your computer and use it in GitHub Desktop.
Save harry-cpp/f8ec780e16201f81ccd5234856546414 to your computer and use it in GitHub Desktop.
VSCode extension for Nautilus
Moved to:
https://github.com/cra0zy/code-nautilus
since people want to add features to it and no notification arrive from comments on gist.
@Borvik
Copy link

Borvik commented May 10, 2018

Great script. Very Handy.

I have found an issue though. When opening VSCode using this, the environment variables aren't replicated properly.

When opening a directory via a terminal with code . I can run Ctrl + Shift + B and it runs my gulp file fine, for another project it launches node fine as well. It also works when choosing the VSCode launcher (I'm on Ubuntu 18.04). However, when opening the directory from the nautilus extension, neither works ok - it can't find gulp or node via the path.

I have attempted the following (not at the same time), but neither worked - and I very rarely work with Python (I did run nautilus -q between changes)

call(VSCODE + ' ' + args + safepaths + '&', env=os.environ.copy(), shell=True)
subprocess.Popen(VSCODE + ' ' + args + safepaths + '&', env=os.environ.copy())

@harry-cpp
Copy link
Author

How are you setting the env variable? I can't seem to repro the issue.

@harry-cpp
Copy link
Author

I'm calling it now, @Borvik is setting his env variables in .bashrc, which does not get executed by the login shell, unlike the .profile.

@Borvik
Copy link

Borvik commented May 14, 2018

Sorry didn't see your comments. Node is install via NVM, so nvm is managing the environment variables for its location.

@harry-cpp
Copy link
Author

I don't use Node so you're gonna have to check where its setting its environment variables.

Any environment variables passed to the login shell get passed to Nautilus which in turn get passed to something like VS Code.

@Borvik
Copy link

Borvik commented May 15, 2018

Looks like .profile loads .bashrc if it is a bash environment. And nvm is modifying the path due to a script called in .bashrc - so it looks like your assumption was correct.

@jhit
Copy link

jhit commented Oct 18, 2018

Can we make this a real repo. I'd like to add translation to German

@Sharpiro
Copy link

Sharpiro commented Feb 1, 2019

in fedora the required package is:

sudo dnf install nautilus-python

@Guthers
Copy link

Guthers commented Feb 12, 2019

This is some good stuff. I think you can simplify your download and install command by changing cp to mv. But otherwise works perfectly.

For ubuntu 18.04:

  1. sudo apt install python-nautilus
  2. Run download command in gist
  3. ???
  4. Profit

Copy link

ghost commented Mar 15, 2019

For Russian users. To use Cyrillic in the names of menu items, specify # -*- coding: utf-8 -*- at the first line of the file (Before the author’s comment)
Now, you can replace Open In to Открыть в

@genericUser0000
Copy link

How to use it?

@7aman
Copy link

7aman commented May 13, 2019

I made a shell script based on this gist.
https://github.com/7aman/code-here

Easy Installation for Ubuntu, Fedora and Debian:
wget -qO- https://raw.githubusercontent.com/7aman/code-here/master/install.sh | bash

It is not maintained anymore.

@harry-cpp
Copy link
Author

Man am I late to the comment party. I get no notifications from the gist so I haven't even noticed people leaving comments.

I finally made a repo for this: https://github.com/cra0zy/code-nautilus in case someone want to add to it, I'll try to add Arch Linux Aur package for the extension as well.

@Sharpiro @Guthers Thanks for the python-nautilus package links ^^

@jhit @via-profit If you want to add translations, feel free to make a PR. On an unrelated note my mother tongue also uses Cyrillic characters.

@7aman I feel like I should apologize for making a repo, as I see you already made one. Also always try to skip checking for distro name, instead check for a package name as it gives your script much better compatibility with much less work.

@7aman
Copy link

7aman commented May 16, 2019

@cra0zy Thanks for tip and your repo. I archived my repo.

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