Can a single Nautilus window be started with multiple tabs?
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
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.