Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to know how I can have an extra pane (press F3) in the file manager by default.

Currently, I add extra pane and when I close the File Manager, I have to add it again.

It's a shortcut away but I feel more productive when I have it and I don't think of adding it systematically.

share|improve this question
    
I believe you would have to report a bug on Nautilus, because as far as I know, this is not a feature that Nautilus has :/ –  RolandiXor May 1 '11 at 22:58
add comment

3 Answers

up vote 2 down vote accepted

For 12.04 / 12.10

I will use the vim editor, but if you don't know it, feel free to replace vim by nano (easy terminal editor) or gedit (gui editor).

Installing xdotool
You can install xdotool via the software center: xdotool Install xdotool.

or via

sudo apt-get update && sudo apt-get install xdotool

Creating a custom script to launch nautilus
Create a script with the following content

#!/bin/bash
nautilus $1 && sleep 0.5 ; xdotool key --clearmodifiers F3

and save it somewhere, let's assume we save it as ~/scripts/nautilus.bash

Make the script executable with chmod +x ~/scripts/nautilus.bash. Now test the script, typing scripts/nautilus.bash should open nautilus, and after a split second you should get your extra pane.

Modifying the desktop file
The desktop file of an application determines how your application will show up in the Unity launcher and dash, and what happens when you click on it.

You can use locate to find out its location

locate nautilus.desktop

This will return

/usr/share/applications/nautilus.desktop

Now to make sure nothing bad happens let's back it up:

sudo cp /usr/share/applications/nautilus.desktop /usr/share/applications/nautilus.desktop.bak

Now we can safely edit it (remember to use gedit or nano if you don't know vim):

sudo vim /usr/share/applications/nautilus.desktop

Now you will see the following (I removed some content in the middle)

[Desktop Entry]
Name=Files
Comment=Access and organize files
Exec=nautilus %U
...

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus
OnlyShowIn=Unity;

We're interested in the Exec= lines, these lines determine what happens when we click the application. We need to change both (the one under [Desktop Action Window] is the entry in the Unity quicklist).

Now replace nautilus in the Exec= line by the location of your script, in my case /home/gerhard/scripts/nautilus.bash (The %U in the top one should stay). Now save and exit.

Test it
If you had nautilus locked to your launcher it will have disappeared, search in the Dash for 'Files' and clicking it should open nautilus with an extra pane!


Notes
If it works only sometimes (or not at all), maybe increase the time it waits before doing the keypress by increasing the value for the sleep function in your script.

share|improve this answer
    
i thank you for you answer,it is a great answer but as i specified in the question i don't want to use xdotool as a solution/workaround.. –  marc-andre benoit Jan 16 '13 at 11:07
    
i'd rather find a native solution.. or hack into the source code or a fork or even use nemo if it has the functionality or at least its devs are open to implementing the option... also.. yes i know how to use vim and no i dont use emacs :) –  marc-andre benoit Jan 16 '13 at 11:14
    
don't get me wrong.. the xdotool workaround is an elegant solution.. just not the one i'd want to use at the moment... –  marc-andre benoit Jan 16 '13 at 11:15
add comment

Run:

nautilus && sleep 0.5 ; xdotool key --clearmodifiers F3

You have to install xdotool first.

share|improve this answer
1  
Probably takes quite a bit longer than pressing F3... –  fabricator4 Nov 11 '12 at 0:22
add comment

I found somewhat I needed more elaborate use of xdotool. While I was at it I decided a script taking an optional second directory argument for the new panel might be useful:

if  [ ! -d "$1" ];  then
 echo "parameter 1 not a directory"
 exit 1
fi 

theSubDir=${1##/*/}   #Deletes /*/ from front of $1, giving nautilus window title
file_browser_id=$(xdotool search --name "$theSubDir" | head -1)

if [ -n  "$file_browser_id" ]; then     # nautilus already open in directory
 exit 
fi 

nautilus "$1"
sleep 0.5
file_browser_id=$(xdotool search --name "$theSubDir" | head -1)

if [ -z  "$file_browser_id" ]; then
  echo no nautilus
  exit 
fi 

xdotool search --name "$theSubDir" windowactivate --sync key --window 0 F3

if [ $# -gt 1 ];  then 

 if  [ ! -d "$2" ];  then
  echo "source parameter not a directory"
  exit 1
 fi 

 xdotool search --name "$theSubDir" windowactivate --sync \ 
   key --window 0 --clearmodifiers Ctrl+l # location bar to path
 xdotool search --name "$theSubDir" windowactivate --sync type "$2" 
 xdotool search --name "$theSubDir" windowactivate --sync \
   key --window 0 --clearmodifiers Ctrl+l Return 
fi
share|improve this answer
add comment

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.