Files can be sent to the mobile device within Nautilus. Is there a possibility to bring this feature to the file browser Nemo?
(I am on Ubuntu 18.04, but I guess other distributions with Nemo would have the same interest.)
@Filbuntu
GSConnect creates a symlink to its Nautilus script if it finds a nautilus-python/extensions directory under the GLib user_data_dir ($HOME/.local/share/ by default), since it depends on Nautilus having the ability to host Python-based extensions.
Do you know if there's a corresponding nemo-python extension for Nemo? If so, and it creates a nemo-python dir of its own, it should be possible to detect that directory and create a symlink there as well. (Or, if nemo-python can be told to use scripts from the nautilus-python directory as well, that'd permit it to work with zero adjustment needed.)
...Never mind, I finally found it. Seems the Fedora package is misnamed python3-nemo, just like nautilus-python used to be until that caused some major problems and the name got fixed.
So, yeah, if you install nemo-python (or whatever it's called), then do the following:
cd $HOME/.local/share/
mkdir -p nemo-python/extensions
cd nemo-python/extensions/
ln -s "$HOME/.local/share/gnome-shell/extensions/[email protected]/nautilus-gsconnect.py" .
That should add the same capability to Nemo. If it works, we can add the creation of that symlink to GSconnect itself.
@ferdnyc Thanks a lot, Frank, for the quick and hopeful reply!
Yes, I have nemo-python installed on my Ubuntu 18.04 and I followed your instructions and the symlink was made. I can also see another file nautilus-gsconnect.pyc in the same folder. But it does not seem to work. I can not see anything in the context menu of a file (left-click).
There are two folders in the $HOME/.local/share/nemo: actions and scripts for plugins. I copied the symlink into these folders, but no "send to mobile device" option appears, either.
I have quit and restarted Nemo but no change, either. And I restarted the computer as well but still no option to send files from Nemo.
Any other tip?
@ferdnyc Thanks a lot, Frank, for the quick and hopeful reply!
Yes, I have nemo-python installed on my Ubuntu 18.04 and I followed your instructions and the symlink was made. I can also see another filenautilus-gsconnect.pycin the same folder.
Well, that's a good sign, that means Nemo-python is at least _trying_ to run the extension, since the .pyc file is the byte-compiled Python that's generated from the source when Python loads it.
But it does not seem to work. I can not see anything in the context menu of a file (left-click).
There are two folders in the $HOME/.local/share/nemo:actionsandscriptsfor plugins. I copied the symlink into these folders, but no "send to mobile device" option appears, either.
Yeah, that won't help unfortunately, the first location is the correct/only one. Buuuuut...
Looking at the nautilus-gsconnect.py code itself, it makes use of the Nautilus library module at several points in the code. Presumably, even if Nautilus is installed on your system, the extension's attempts to interface with Nautilus from within nemo-python will either fail utterly, or simply have no effect on Nemo.
It's possible to generalize the code so that it works under either application, the thing I'm not having any luck tracking down is a way to _detect_ which of the two we're running under, from inside the code. Which is unfortunate, because it would be great if we could use the same exact extension code for either application, instead of having to maintain two separate files. I'll keep digging on that.
_For now_, here are two versions of the extension code, one for each file manager, where I've generalized the code so that they differ by just a single variable set at the top of the file. (If I can work out how to automatically determine the value of that one variable, then they won't have to differ at all.):
gsconnect-filemanager-extensions.zip
It should be obvious from the name where each file goes. (You can install the Nautilus version over the existing symlink or not, up to you.) In my quick testing, this nemo-gsconnect.py version worked under nemo-4.2.2 with nemo-python-4.2.0 on Fedora 30.
...Never mind, I finally found it. Seems the Fedora package is misnamed
python3-nemo, just likenautilus-pythonused to be until that caused some major problems and the name got fixed.
On the plus side, my PR to change the Fedora package name back to nemo-python, like it always should've been, has already been merged. So, that's something.
And as the draft-PR linking indicates, above (I _think_ that's publicly visible? Hopefully or I'll sound like I'm hallucinating), I have code _almost_ ready to check in to the repo, to implement this. I'm just trying to hunt down some way I can make that final line of code automatic, instead of having to force it per-application.
^ I've reached out to the Nemo extensions maintainers, to see if they have any ideas regarding the detection issue.
(ETA: They did, and autodetection is now part of the single-script extension code, which GSConnect will link into both file managers' python extensions path.)
_For now_, here are two versions of the extension code, one for each file manager, where I've generalized the code so that they differ by just a single variable set at the top of the file. (If I can work out how to automatically determine the value of that one variable, then they won't have to differ at all.):
gsconnect-filemanager-extensions.zip
It should be obvious from the name where each file goes. (You can install the Nautilus version over the existing symlink or not, up to you.) In my quick testing, this
nemo-gsconnect.pyversion worked undernemo-4.2.2withnemo-python-4.2.0on Fedora 30.
This version of the extension nemo-gsconnect.py worked for me (copied to the folder nemo-python/extensions/), too (with Nemo 3.6.5, nemo-python 3.6.0-1.1~bionic2, Ubuntu 18.04)!
Thanks a lot for your speedy and helpful work on this!
@Filbuntu
When the next version of GSConnect comes out, it'll have code to link nemo-gsconnect.py to the nautilus-gsconnect.py script in its installation directory. But since nemo-gsconnect.py will already exist for you, it won't remove the existing file.
So, once v25 is released and you've upgraded, you'll probably want to reset to the "official" setup with a version of the commands from my first comment. That'll ensure that you're running with the official extension, since the code is _slightly_ different now (and may diverge more in the future):
cd $HOME/.local/share/nemo-python/extensions/
rm nemo-gsconnect.py
ln -s "$HOME/.local/share/gnome-shell/extensions/[email protected]/nautilus-gsconnect.py" \
nemo-gsconnect.py
(The next-to-last line has a continuation character at the end. I wrapped it to two lines, since it extends off the screen and text-selection to the end of long lines is annoying with GitHub's layout. But selecting the whole thing and copy-pasting it into a shell will work properly.)
@ferdnyc Thank you very much for still thinking of me!
I will do as you suggested! Thanks again so much for enabling support for the Nemo file browser!
Most helpful comment
@Filbuntu
When the next version of GSConnect comes out, it'll have code to link
nemo-gsconnect.pyto thenautilus-gsconnect.pyscript in its installation directory. But sincenemo-gsconnect.pywill already exist for you, it won't remove the existing file.So, once v25 is released and you've upgraded, you'll probably want to reset to the "official" setup with a version of the commands from my first comment. That'll ensure that you're running with the official extension, since the code is _slightly_ different now (and may diverge more in the future):
(The next-to-last line has a continuation character at the end. I wrapped it to two lines, since it extends off the screen and text-selection to the end of long lines is annoying with GitHub's layout. But selecting the whole thing and copy-pasting it into a shell will work properly.)