nemo scripts on network shares

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

nemo scripts on network shares

Post by kaefert »

I wanted to ask if anybody knows of a workaround for using nemo scripts (executeable scripts placed in ~/.gnome2/nemo-scripts/) on network shares (like smb://.. or sftp:// locations)?

Those that don't use parameters (like selected files) but just work based on the working directory seem to work for me just the same as locally, but those that need to process parameters = selected files to make something useful don't work on network shares for me. Is there a way to fix that problem?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

I only have one nemo script:

It looks like this so I'm not sure which of your categories it falls in:
#!/bin/sh
exec gnome-search-tool --hidden --path="$(echo $NEMO_SCRIPT_SELECTED_FILE_PATHS)" --contains=
Although it takes forever to run compared to a local folder it does it's job:
Find-Nemo-Script.png
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

thanks for the reply. I made myself this script to test if maybe the different way to access the selected files makes the difference: (I use $1 $2 and so forth normally, which works too, but only locally for me at least)

echo "NEMO_SCRIPT_SELECTED_FILE_PATHS=\"$NEMO_SCRIPT_SELECTED_FILE_PATHS\"" >> /tmp/nemo-scripts-debug.txt

this adds me such a line in the specified file if executed on two files slected on an smb network share:
NEMO_SCRIPT_SELECTED_FILE_PATHS=""

when executing on 2 random local files I get these 3 lines:
NEMO_SCRIPT_SELECTED_FILE_PATHS="/home/kaefert/ownCloud/.owncloudsync.log
/home/kaefert/ownCloud/.owncloudsync.log.1
"

so it seems if what you mentioned works, that means your system either works better, or your application works because it only needs to use the working directory, not the selected files to do what you want it to.
DrHu

Re: nemo scripts on network shares

Post by DrHu »

Why can't you just map or link the file location from the share or even mount via fstab
--so that you can execute contents within that file via your script command..
http://ubuntuforums.org/showthread.php?t=943835
http://ubuntuforums.org/showthread.php?t=1868414
--mapping/linking/gaining access to folders

http://www.gearhack.com/Forums/DisplayC ... amba_Share
--that was a standard problem
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

because I handle lots of different smb and sftp shares and I don't want to manually mount and map / link every one of them. I simply want to use it the simple way I'm used to, by entering a smb:// or sftp:// url into nemo.

the simplest (but still quite annoying) workaround that I found and use for this problem:
Use "Open in Terminal" which works also in network shares and execute the necessary commands from there, instead of through nemo-scripts.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

Okey, so now I've found this documentation: https://help.ubuntu.com/community/NautilusScriptsHowto
That taught me that there is another variable, which does work for network shares:

NEMO_SCRIPT_SELECTED_URIS

so together with this, and the output of `pwd` I guess I could build myself the correct paths. this complicates my nemo scripts a bit but for the ones I use often I guess adapting the scripts costs me less time than using my open-terminal workaround (see previous post) every time I need to execute one of it on a network share.

If anybody is interested in the detail, this is my nemo-scripts debug-script:

Code: Select all

echo "#####################################################" >> /tmp/nemo-scripts-debug.txt
echo "###### nemo-script test! ###### `date +%F_%T:%S`" >> /tmp/nemo-scripts-debug.txt

echo "pwd=\"`pwd`\"" >> /tmp/nemo-scripts-debug.txt
echo "all-parmaeters=\"$@\"" >> /tmp/nemo-scripts-debug.txt
echo "NEMO_SCRIPT_SELECTED_FILE_PATHS=\"$NEMO_SCRIPT_SELECTED_FILE_PATHS\"" >> /tmp/nemo-scripts-debug.txt
echo "NEMO_SCRIPT_SELECTED_URIS=\"$NEMO_SCRIPT_SELECTED_URIS\"" >> /tmp/nemo-scripts-debug.txt
echo "NEMO_SCRIPT_CURRENT_URI=\"$NEMO_SCRIPT_CURRENT_URI\"" >> /tmp/nemo-scripts-debug.txt
echo "NEMO_SCRIPT_WINDOW_GEOMETRY=\"$NEMO_SCRIPT_WINDOW_GEOMETRY\"" >> /tmp/nemo-scripts-debug.txt

echo "NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=\"$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS\"" >> /tmp/nemo-scripts-debug.txt
echo "NAUTILUS_SCRIPT_SELECTED_URIS=\"$NAUTILUS_SCRIPT_SELECTED_URIS\"" >> /tmp/nemo-scripts-debug.txt
echo "NAUTILUS_SCRIPT_CURRENT_URI=\"$NAUTILUS_SCRIPT_CURRENT_URI\"" >> /tmp/nemo-scripts-debug.txt
echo "NAUTILUS_SCRIPT_WINDOW_GEOMETRY=\"$NAUTILUS_SCRIPT_WINDOW_GEOMETRY\"" >> /tmp/nemo-scripts-debug.txt

echo "#####################################################" >> /tmp/nemo-scripts-debug.txt
which produces this output for a selection of two random local files:

Code: Select all

#####################################################
###### nemo-script test! ###### 2015-03-03_13:02:08:08
pwd="/tmp"
all-parmaeters="site6540685525022174599xml site1384044781342170831xml"
NEMO_SCRIPT_SELECTED_FILE_PATHS="/tmp/site6540685525022174599xml
/tmp/site1384044781342170831xml
"
NEMO_SCRIPT_SELECTED_URIS="file:///tmp/site6540685525022174599xml
file:///tmp/site1384044781342170831xml
"
NEMO_SCRIPT_CURRENT_URI="file:///tmp"
NEMO_SCRIPT_WINDOW_GEOMETRY="958x515+2880+0"
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=""
NAUTILUS_SCRIPT_SELECTED_URIS=""
NAUTILUS_SCRIPT_CURRENT_URI=""
NAUTILUS_SCRIPT_WINDOW_GEOMETRY=""
#####################################################
and this output for two files on a remote sftp:// share:

Code: Select all

#####################################################
###### nemo-script test! ###### 2015-03-03_12:53:12:12
pwd="/run/user/1000/gvfs/sftp:host=adress,user=myuser/remotepath"
all-parmaeters=""
NEMO_SCRIPT_SELECTED_FILE_PATHS=""
NEMO_SCRIPT_SELECTED_URIS="sftp://myuser@adress/remotepath/file1
sftp://myuser@adress/remotepath/file2
"
NEMO_SCRIPT_CURRENT_URI="sftp://myuser@adress/remotepath"
NEMO_SCRIPT_WINDOW_GEOMETRY="958x515+1920+538"
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=""
NAUTILUS_SCRIPT_SELECTED_URIS=""
NAUTILUS_SCRIPT_CURRENT_URI=""
NAUTILUS_SCRIPT_WINDOW_GEOMETRY=""
#####################################################
so to get the "local path" for the automounted remote files I need to use substring on each line of NEMO_SCRIPT_SELECTED_URIS and remove everything before the last / and join it together with the output of `pwd` to get the files that I would have expected to find in both $@ and NEMO_SCRIPT_SELECTED_FILE_PATHS..

Does anybody know a way to reach out to the nemo or nemo-scripts developers to maybe get them to fix this bug to make this quite complicated workaround unnecessary?
Last edited by kaefert on Tue Mar 03, 2015 9:54 am, edited 3 times in total.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

First, yikes!

Second:
Does anybody know a way to reach out to the nemo or nemo-scripts developers to maybe get them to fix this bug to make this quite complicated workaround unnecessary?
You can of course submit a bug report here: https://bugs.launchpad.net/linuxmint

Now this is pure speculation on my part but I don't think there is a nemo-script developer. I think they took the source for nautilus-scripts and did a bulk rename of the word nautilus to nemo. That would mean the change would have to be made to nautilus-scripts first and it's unclear to me anyway if and when such a change would be incorporated into Mint:

From: http://blog.linuxmint.com/?p=2613
The decision was made to stick to LTS bases. In other words the development team will be focused on the very same package base used by Linux Mint 17 for the next 2 years. It will also be trivial to upgrade from version 17 to 17.1, then 17.2 and so on. Important applications will be backported and we expect this change to boost the pace of our development and reduce the amount of regressions in each new Linux Mint release. This makes Linux Mint 17.x very important to us, not just yet another release, but one that will receive security updates until 2019, one that will receive backports and new features until 2016 and even more importantly, the only package base besides LMDE which we’ll be focused on until 2016.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

first, yes, yikes..

a nemo-script that starts meld for comparing two files, that works locally simply looks like this:

Code: Select all

meld $@
to do the same on a remote network share, I've come up with this one:

Code: Select all

#!/bin/bash
outsideIFS=$IFS
IFS="
"
files=""
for line in $NEMO_SCRIPT_SELECTED_URIS; do
  f="${line##*/}" #get only the filename, remove the path
  d=$(echo "$f" | echo -e $(sed 's/%/\\x/g'))  #echo -e + sed for urldecoding (works with spaces in filename)
  files="$files$d
"
done
meld $files
IFS=$outsideIFS
and secondly, thanks, I've reported the bug here:
https://github.com/linuxmint/nemo/issues/849
--> do you think it makes sense to aditionally report it there
https://bugs.launchpad.net/linuxmint
also?
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

--> do you think it makes sense to aditionally report it there
https://bugs.launchpad.net/linuxmint
also?
You can try.

I have submitted a few bug reports ... and um ... things didn't quite work out so well.

If it's something that Mint created you have a better chance that it will get the attention you think it should. But take this case for example:

nemo-scripts is really a re-branded nautilus-scripts so it may just get pushed to Ubuntu because that's where the package originally came from. Ubuntu didn't create nautilus-scripts Gnome did so the bug will just get pushed to Gnome. Gnome may or may not fix it but say they do. It's unlikely that Ubuntu will apply the fix to the LTS version that Mint was based on ( 14.04 ) because Ubuntu rarely does that sort of thing to the OS that has already been released - even LTS versions. It will most likely show up in Ubuntu 15.04 or even later.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

hmm, well I think that the new gnome with the new nautilus does not support nautilus-scripts anymore. so I guess its a lost cause and I should be happy to have found a workaround where I only need to adapt my nemo-scripts that I want to use on network shares once and forget about that bug.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

Well, I have submitted bug reports in 4 different distros but except for one of them they have all been samba related. Samba bugs are something all distros ignore because it's just one unknown black box to them even though they created the problem.

Your experience may be different.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

Um ... I just ran an experiment on my system. I run Xubuntu so my file manager is thunar.

I created the equivalent of a nautilus-script called a thunar-custom-action, named it Meld, and defined it with this command:

Code: Select all

meld %F
If I connect to a remote share and select two files the "Meld" context menu doesn't even show up.

If I go to the mount point of that smb mount it does show up and works just fine:
Meld-Thunar.png
I can't easily switch to Mint Cinnamon at the moment but you might want to investigate the possibility of using the gvfs mount point with your script.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

my nemo automatically translates the path into the sftp:// or smb:// URI as soon as I open a folder inside /run/user/1000/gvfs
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: nemo scripts on network shares

Post by altair4 »

Install thunar?

It's small. In Mint Cinnamon 17.1:
Need to get 1,754 kB of archives.
After this operation, 11.9 MB of additional disk space will be used.
It's under Menu > Administration > Thunar File Manager and it doesn't resolve back to smb://.... when you go to /run/user/1000/gvfs/....

Then run it and go to Edit > Configure Custom Actions > +
TCA-Meld.png
Just a suggestion .....
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
kaefert
Level 3
Level 3
Posts: 110
Joined: Sun Jan 08, 2012 12:08 pm

Re: nemo scripts on network shares

Post by kaefert »

hmm, well thanks for the suggestion, but I like nemo quite a lot and I also think that even if I where using thunar, I'd prefer to adapt my scripts once than needing to switch to /run/user/1000/gvfs/ every time after having mounted a share through entering its smb://.. or sftp://.. URI.

I've by now extracted the code to extract the filenames from the URIs into a seperate script which I then call from my nemo-scripts.

Code: Select all

#!/bin/bash
outsideIFS=$IFS
IFS="
"
files=""
for line in $1; do
  f="${line##*/}" #get only the filename, remove the path
  #echo "" >> /tmp/nemo-scripts-list-selected-files_debug.txt
  #  | tee --append /tmp/nemo-scripts-list-selected-files_debug.txt
  echo "$f" | echo -e "$(sed 's/+/ /g; s/%/\\x/g')"  #echo -e + sed for urldecoding (works with spaces in filename)
done
IFS=$outsideIFS
Locked

Return to “Cinnamon”