Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Add functions to right-click drop-down menu

    I use gnome 2 and I was wondering how can one add functions to the drop-down menu when you right-click onto a file. The particular motivation for this is that I'd like to get an option when right-clicking on a .tex file that would allow to compile it and get the output files in the same directory. The idea is to avoid using the command line or any LaTeX editor with a built-in compiler. How difficult is to do that?

    I'm relatively new at Linux, I always used newbie friendly distros and I did never get really into the insides of scripting, so please feel free to redirect me to another forum if the question doesn't fit here.

  2. #2
    write a bash script that will do what you need it to do. have it take your file (the one you are right-clicking on) as the first argument. Here's a short example:
    echo The file is $file
    xmessage "The file is $file"
    # do compiling, etc, stuff with $file now...
    Call this file and put it in the ~/.gnome2/nautilus-scripts/ directory. Don't forget to make it executable, e.g.:
    chmod +x ~/.gnome2/nautilus-scripts/
    Run it from the command line to make sure it works, e.g.:
    ~/.gnome2/nautilus-scripts/ /tmp/file.txt
    To test it, open the nautilus file manager and right-click a file (or use a file on the desktop), and select Open With, then browse to your script.

  3. #3
    Thanks for the tip atreyu. I'm not skilful with script writing so I'd rather try something easier. By means of nautilus-actions I already got the "compile" (that's the name I chose) option when right-clicking on .tex files, but for whatever reason the output files appear in the home directory instead than the directory where the .tex file is stored. I guess there's a way to redirect the files to the desired directory by writing the appropriate parameters in the command tab (I'm using the GUI for nautilus-actions) but I can't figure out which are the correct ones. Any ideas?

  4. $spacer_open
  5. #4
    Ah, never used nautilus-actions, that seems like the way to go.

    What do you mean by "compile" - is that what you put for "Label" (in the nautilus-actions-config window)? What do you have for Path and Parameters under Action?

  6. #5
    Yes, "Compile" is just the word for the label because this was the word I wanted to appear in the drop-down menu. Right now I'm working on my laptop while before I was working on my computer at work and the situation is rather different in each case:

    At work

    OS: Ubuntu 10.04
    nautilus-actions version: not sure, I cannot check it now
    Path: /usr/bin/latex
    Parameters: %M


    OS: LMDE
    nautilus-actions version: 3.1.2
    Path: /usr/bin/latex
    Parameters: %F
    Working directory: %d

    The change of %M by %F is just a question of the newer version, but the command is the same in each case.

    The extra option "working directory" only appears in the second case and seems to be the key point because the behaviour in the second case is exactly the one expected. The output files appear in the desired directory. Now I have to find out how to emulate this function in the other case (another possibility would be to try to find repositories to download a newer version of nautilus).

  7. #6
    Solved. The correct string in Parameters is "-output-directory=%d/%M".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts