Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to give my image uploader some kind of rightclick->upload functionality. Currently I use the nautilus-scripts folder, but that puts the menu entry behind an unapparent "Scripts" item.

I've tried looking it up but I can only find people referencing nautilus scripts or Nautilus Actions (which isn't what I want for packaging).

share|improve this question

In my case, I needed to make a script for Meld to compare modifications to folders/files.

I'm running on UbuntuGNOME 14.04, with gnome-shell 3.10 and Nautilus (Files) 3.10.1.

And I've done like this:

  1. Open the folder ~/.local/share/nautilus/scripts/.
  2. (Optionally) Create a sub-folder to your script, which in my case was Meld/.
  3. Create your bash, perl or python script (see the sample at the end of answer).
  4. Make your script executable (right-click at script file > properties > permissions > mark the execute option)
  5. To make sure that Nautilus will apply the changes, I've restarted Nautilus, running nautilus -q; nautilus; in a terminal.

And now, you can right-click on any folder/file to see the context menu Scripts > my-script.

Sample: scripts/Meld/Compare_with_Meld

#!/bin/bash    
meld $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS

Predefined Nautilus variables:

  • NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
    newline-delimited paths for selected files - only if local ( i.e. /home/user/someFile).
  • NAUTILUS_SCRIPT_SELECTED_URIS
    newline-delimited URIs for selected files (i.e. file:///home/user/someFile).
  • NAUTILUS_SCRIPT_CURRENT_URI
    current location
  • NAUTILUS_SCRIPT_WINDOW_GEOMETRY
    position and size of current window

Laters!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.