How can I make Nautilus open with an extra panel by default?

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.


Solution 1:

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.

Solution 2:

Run:

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

You have to install xdotool first.