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.

When I fist start Nautilus I invariably open five favourite tabs..

I've tried multiple URIs from the command line, but it opened multiple windows.

Is it possible to somehow do this via command-line ?...

share|improve this question
    
This doesn't appear possible, best thing to do here is probably file a wishlist bug upstream in Nautilus and see if someone will implement it. –  Jorge Castro Feb 13 '11 at 19:49
    
@Jorge: Thanks... In that case, I've hacked a macro workaround, and posted the script as an answer –  Peter.O Feb 14 '11 at 6:29

2 Answers 2

up vote 3 down vote accepted

As per jorge's comment, the answer is "no"...


So as a side issue, because it's not a current option in Nautilus, I've cobbled together a script.. It suits me, given the situation.
I initially had some timing inssues which caused modifier-key states to go whacko, so I've added 100ms delays between steps, and it is now behaving itself on my system...
This may need to be changed in a different environment... Here it is; at paste.ubuntu.com

share|improve this answer
2  
The script is no longer online... Can you place it online gain? –  WG- Mar 5 '13 at 23:22
    
do you still have that script? –  Aquarius Power May 31 at 7:42

It is still unsupported by Nautilus itself, however you can use a script that admits several parameters to reuse or open a new instance of Nautilus if not running.

In order to use this solution you'll need to install pachages wmctrl and xclip. You can do it installing wmctrl and xclip using the Software Center (click on the links) or via Terminal with sudo apt-get install wmctrl xclip.

Create a new file nautab.sh and add the following code:

#!/bin/bash
# Nautilus opens folders in new tabs
# Dependencies: sudo apt-get install wmctrl xclip
# Pass directories as parameters, i.e. nautab /opt /var/log /usr/local/etc
# Wrong parameters will be shown as invalid directories

if [ "$(wmctrl -xl | grep "nautilus\.Nautilus")" == "" ]; then
    # wmctrl reports Nautilus not running
    if [[ -d $1 ]]; then
        nautilus "$1" &
    else
        >&2 echo Not a directory: $1
        nautilus &
    fi
    shift
    # Nautilus takes some time to become responsive to automation
    sleep 2
fi 
#Save old clipboard value
oldclip="$(xclip -o -sel clip)"
for folder in "$@"
    {
    if [ -d "$folder" ]; then   
        echo -n $folder | xclip -i -sel clip
        wmctrl -xF -R nautilus.Nautilus && xdotool key --delay 120 ctrl+t ctrl+l ctrl+v Return
        # Use this if you suspect funny clipboard behaviour
        #xclip -verbose -o -sel clip
        #Leave some time before opening a new tab
        sleep 0.5
    else
        >&2 echo Not a directory: $folder 
    fi
}
#Restore old clipboard value
echo -n "$oldclip" | xclip -i -sel clip

This code is based is based on an answer to other question: http://askubuntu.com/questions/55656/open-nautilus-as-new-tab-in-existing-window.

Runnautab [directory]... and new tabs will open on it. Note that there will be some delay; this is in order to wait for Nautilus to be responsive. Feel free to play with numbers.

share|improve this answer

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.