3

I am trying to add a button or right click option to Nautilus for an assignment. When I click the button or right click option it should encrypt the file that is highlighted. But I am getting way ahead of myself. I do not know where in the source code I would add this new button feature. How/Where do I edit the source code of Nautilus to add a button and then add the code for encryption? Any help would be much appreciated.

2 Answers2

2

You don't need the source code so don't worry about downloading foo and patching it.

See Nautilus instructions for creating your own script here (Help Ubuntu - Nautilus Scripts How to). Basically you:

  • Navigate to the directory ~/.local/share/nautilus/scripts/
  • Place your script (written in Bash, Perl or Python) there.
  • Mark the script as executable using Nautilus or from terminal with chmod +x script_name
  • Nautilus makes environmental variables available to your script: NAUTILUS_SCRIPT_SELECTED_FILE_PATHS, NAUTILUS_SCRIPT_SELECTED_URIS, NAUTILUS_SCRIPT_CURRENT_URI, and NAUTILUS_SCRIPT_WINDOW_GEOMETRY

There are sample scripts located at (Help Ubuntu - Nautilus Sample Scripts) for e-mailing files, mounting an ISO file, setting files to read only, editing file with gedit ROOT priviledges, opening terminal at current location, etc.

Look through the scripts and take one as a template for encrypting files using right-click.

0

Install apt-src, whose man page says, in part:

 To install a local copy of package foo, which you are going to apply a local patch to:

     apt-src install foo
     cd foo-version
     patch <~/my-foo-patch
     apt-src build --installdebs foo
waltinator
  • 37,856