In Nautilus, I have upon right-clicking a directory, the option to open a Terminal with the prompt in the selected directory. I think this is very handy and I use it a lot.

Now I would like to use Guake instead of the classic terminal. Is there a way to do this?

I'm struggling with nautilus-actions. I can open Guake allright (i.e. it drops down from the top since it's permanently loaded), but the prompt isn't located at the directory of choice. In addition, it's one more mouseclick to open the terminal (if it would work), I would prefer a shorter way.

Anyone any idea how to manage this? (or could this be a possible feature request?)

Ubuntu 12.04, gnome-classic without Unity

  • 1
    If anyone's wondering how the OP has the option to open a terminal from Nautilus, you can just do: sudo apt-get install nautilus-open-terminal. For Guake, you'll have to follow the answer though. – Garrett Oct 8 '14 at 4:12

Ok, so I found a shell script that will work and modified it to work with guake. To get it working follow these steps.

  1. Create a new empty document, Right click => Create New Document => Empty Document
  2. Name It Open in Guake or something similar
  3. Open it and paste the code listed below- Source 1 (This is needed because the nautilus returns a specific file path and it needs to be reformatted to work in the terminal.)

    # From Chris Picton
    # Replaces a Script by Martin Enlund
    # Modified to work with spaces in path by Christophe Combelles
    # Modified to use guake by Matthew Jump
    # This script either opens in the current directory,
    # or in the selected directory
    base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
         while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done
    #there should be an embracing around the $dir
    guake --show --execute-command="cd '$dir'"

    Notice the last command is what is used to open the directory in guake --show toggles the apearance of guake, and --execute-command="cd $dir" navigates to the directory. run man guake (in terminal) for a complete list of commands (note that it gets complicated with mixing comands).

  4. Save the file and then place it in:

    For 12.04: ~/.gnome2/nautilus-scripts
    For 14.04: ~/.local/share/nautilus/scripts/

    Which are hidden folders in your home folder, to view hidden folders go to => View => Show Hidden Files

  5. Now we need to make the file executable, Right click on the file go to > Properties > click Permissions tab > look for "Execute" and check "Allow executing file as program" then close out.

Next We just need to try out the script, right click a folder in Nautilus, then go to =>Scripts => Open in Guake

Now you have a custom "Open in Guake" script on your right click.

Open in new Guake tab and rename tab as path:
I made some changes to the script to open a new tab in Guake and rename the tab after the directory. So if you want to use these changes just replace the last line of the code with this-

guake -n "$dir" -r "$dir" -t

-n "$dir" makes a new tab with the directory as its prompt, so its faster than executing "CD" like I did above. And -r is to rename the tab.

Open in new tab, with short name for current directory:
It now shows either the directory name you are in or the selected directory depending on where you right click, for files and the blank space the folder name of the directory you are in, for selecting a folder it displays the folder name, to use just replace the last line with this code-

guake -n "$dir" -r "`echo ${dir%/} | rev | cut -d'/' -f1 | rev`" -t

the quotes around $dir also fix an issue i had with certain folders that had a lot of spaces.

| improve this answer | |
  • Tried it and works. Not only does it open the selected directory, but if a file is selected, it opens the directory the file is in. This is exactly what I needed, thanks a lot +++ – Tinellus Jun 20 '12 at 4:04
  • I added a bit to make a new tab and rename it – Mateo Jun 20 '12 at 14:25
  • Also tried that one, and works. Thank you so so very much, I will definitely keep using this. One more remark though: most of my tabs will have uncomfortably long names (/home/Pictures/2011/xxx/ etc...). Would it be possible to keep only the name of the last directory? Nevertheless, the bounty is yours... – Tinellus Jun 20 '12 at 17:33
  • Just awarded you the bounty. Thanks for all your efforts... Just tried it: works elegantly, exactly what I needen. On top of the service you have given me, you gave me, the completest noob, much insight in coding. Thanks – Tinellus Jun 21 '12 at 6:54
  • 4
    For Ubuntu 13.04 I had to put the script into /home/$USER/.local/share/nautilus/scripts/ I also had to put the -t onto a new line e.g: guake -n "$dir" -r "`echo ${dir%/} | rev | cut -d'/' -f1 | rev`" guake -t – thelastshadow Jul 30 '13 at 9:07

Ok, so the script didn't work well for me, and I didn't like having to go through the script menu, so I tried with the nautilus-actions configuration-tool

I created a command, used "guake" as path and put this in parameters :

-n '%d%f ' -r "%f " --show -e "cd '%f' && ls -l"

Work good for me. Ubuntu 17.10.

| improve this answer | |
  • Accepted answer didn't work, but this did. Thanks! For those with thunar: edit - Configure custom actions... and guake -n '%d%f ' -r "%f " --show -e "cd '%f' && ls -1FSshX --file-type" – Alnitak Oct 25 '18 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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