After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 633338 - Open (new) multiple tabs from command line
Open (new) multiple tabs from command line
Status: RESOLVED INCOMPLETE
Product: nautilus
Classification: Core
Component: Tabs
2.30.x
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 628683 720651 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-10-28 10:17 UTC by sdaau
Modified: 2018-02-07 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description sdaau 2010-10-28 10:17:51 UTC
Hi all, 


I would like to propose that Nautilus should be able to open a set of folder locations as tabs in a window from the command line. 

(Btw, I believe I had once found a similar proposal elsewhere on the net, but I cannot find it anymore, which is why I'm posting)


The functionality would be similar, to the one currently available in gnome-terminal - that is, currently (I'm on Ubuntu 10.04) I can run: 

gnome-terminal --tab --working-directory=/etc --tab --working-directory=/home

... and this will open a new gnome-terminal window, with two tabs, pointing at /etc and /home directories respectively. 

Note that people disagree whether this is how this functionality is supposed to work in gnome-terminal (https://bugzilla.gnome.org/show_bug.cgi?id=83203); but in this proposal, I'm referring to only this kind of functionality; that is, the command:

nautilus --tab /etc --tab /home
# alternatively: nautilus /etc --tab /home

would open a new nautilus window, with two tabs pointing respectively at /etc and /home directories. 


----
Also - I'm aware is that this would be something, that in principle, should be taken care of by gnome-session. However, there have been problems with gnome-session previously (https://bugzilla.gnome.org/show_bug.cgi?id=552387), and although those are fixed, there is are crucial problems I can see with using gnome-session: 
* you cannot save a session to a given filename - i.e. you can only save one gnome session, by calling gnome-session-save; subsequent calls overwrite last saved session
* I don't know where this session file is saved - and whether it is text-only, so I can make manual changes to it
* If you already are working, and you try to restore the session by calling 'gnome-session' - there is a ton of errors like:
** WARNING **: Failed to acquire org.gnome.SettingsDaemon
** WARNING **: Applet is already running, exiting
** WARNING **: <WARN>  constructor(): Couldn't initialize the D-Bus manager.
** Window manager warning: Screen 0 on display ":0.0" already has a window manager; try using the --replace option to replace the current window manager.

So, since the user, currently, can neither save nor restore nor modify an arbitrary session using gnome-session, I'd argue that it is proper for Nautilus to have its own simple mechanism for saving and restoring "session" ("session" in this context meaning simply a collection of tabs in a window).

----
Note also that something similar, has also been implemented in certain versions of PCManFM file manager; but it's difficult to find references to this on the net - other than a single "fixed multiple instance -t opening of tabs" in
	http://igurublog.wordpress.com/downloads/mod-pcmanfm/#readme

... however, note that in the latest sources, this option seems to be commented out: 
	http://pcmanfm.git.sourceforge.net/git/gitweb.cgi?p=pcmanfm/pcmanfm;a=blob;f=src/pcmanfm.c;h=50488a50eed07a20a62af476d14469c4f69b0473;hb=HEAD



----
# ADDITIONAL PROPOSALS

If this 'multiple tab opening from command line' proposal is reasonable, then I'd propose two possible further enhancements, AP1 and AP2: 


----
## AP1: SAVE currently open tabs in Nautilus window

There would be an option/menu item (maybe under the File menu) called "Save (Currently Open) Tabs..". Choosing this menu item would raise a Save File Dialog, and upon choosing a filename, it will save a text file, consisting simply of a nautilus command opening the same (currently open) set of tabs. 

For instance, if I have Nautilus window open with three tabs, pointing at /root, /home and /var respectively - calling the "Save Tabs" menu entry, and choosing 'restore_n.sh', would generate a 'restore_n.sh' text file, with the following contents inside: 

nautilus \
	--tab /root \ 
	--tab /home \
	--tab /var &

#( alternatively:

nautilus \
	/root \ 
	--tab /home \
	--tab /var &

Thus, by simply doing 'chmod +x restore_n.sh', the user could, from that point on, call the script by doubleclicking it - and restore/reopen the nautilus window with the saved tabs. 


----
## AP2: Make it possible to APPEND new tabs to arbitrary Nautilus window via command line

That, I believe, would require a bit more work (but on the other hand, I could live without it :) ). 

First of all, there shoud be a command line option that will iterate through all open instances of Nautilus, and dump:
* the id of the window (as returned from xwininfo) 
* the set of tabs opened in each info 

I'd propose to call this command line option something like '--dump-instances'. In that case, an example of it would be: 

$ nautilus --dump-instances
Current Nautilus instances: 
#0: (Desktop)
#1: Window id: 0x220307a "/home - File Browser"
@1: 	tab #0: /home
@1: 	tab #1: /etc
@1: 	tab #2: /var
#2: Window id: 0x220a9cf "/root - File Browser"
@2: 	tab #0: /root
@2: 	tab #1: /media
@2: 	tab #2: /home

Then, there would be a complementary command line argument, say "--wininst" (window instance), which would "set" which instance the subsequent --tab entries would refer to. So, in the above example, if we wanted to append '/lib' tab to the first Nautilus window - and '/usr' to the second one - we would call: 

# append tabs
$ nautilus --wininst=0x220307a --tab /lib --wininst=0x220a9cf --tab /usr 

# check
$ nautilus --dump-instances
Current Nautilus instances: 
#0: (Desktop)
#1: Window id: 0x220307a "/home - File Browser"
@1: 	tab #0: /home
@1: 	tab #1: /etc
@1: 	tab #2: /var
@1: 	tab #3: /lib
#2: Window id: 0x220a9cf "/root - File Browser"
@2: 	tab #0: /root
@2: 	tab #1: /media
@2: 	tab #2: /home
@2: 	tab #2: /usr



----
# RATIONALE 

The way I work, is that usually I have a couple of Nautilus windows open, with a respective set of tabs opened in them; then I also have a couple of gnome-terminals open, with a set of tabs in them as well - as I also like to sort of hierarchically organize the workspace. 

Then I compile stuff, and more often than not, something crashes so bad, I have to reboot completely. And that means, next time I have to *manually* reopen everything - and here is what the sequence of steps of this workflow of mine looks like (I also use nautilus-open-terminal):

* log in
* click on desktop shortcut to open first Nautilus window
* Right-click, "Open in Terminal" to open gnome-terminal at same dir
* Click back to first Nautilus window (A1)
* Ctrl-T to open a new tab
* Type the new tab folder location + Enter
* Reselect new tab folder location + Ctrl-C to copy it
* Click on the gnome-terminal 
* Ctrl+Shift+T to open new tab in gnome-terminal
* Type 'cd '
* Hit Ctrl+Shift+V to paste copied address in terminal + ENTER
** REPEAT X TIMES: GOTO A1
* click on another desktop shortcut to open second Nautilus window
* Right-click (on second Nautilus window), "Open in Terminal" to open second gnome-terminal at same dir
* Click back to second Nautilus window (B1)
* ...
** REPEAT Y TIMES: GOTO B1


Now - obviously, no one (especially me :) ) likes to do such repetitive jobs manually - especially since today, we have computers to do those kinds of things :) 

Thankfully (as far as I am concerned), now there is "Nautilus Terminal (Embeded a terminal in Nautilus)" ( http://software.flogisoft.com/nautilus-terminal/en/ ), which solves a LOT of my problems in respect to the workflow described above. 

I'm basically quite happy with "Nautilus Terminal" (and with Nautilus in general :) ) - except I'd like the terminal on bottom; but "nautilus plugin API don't let [devs] do it" https://blueprints.launchpad.net/nautilus-terminal/+spec/terminal-on-bottom ... But it's no biggie - so I feel that I need not nag upstream about this :) 

Now - if only Nautilus supported opening of tabs from command line - and saving of tabs in the same format - then, along with "Nautilus Terminal", this would help me to reduce the above workflow to only a single time setup, and then if the tab collections are saved for both windows - I can collect those commands in a single script, and subsequently restore 'session' after a reboot with a single doubleclick! 


----

I guess, it would also be nice to try to implement this kind of functionality as a plugin - but I don't think the scope of plugin API allows such changes (in particular, I don't believe you can add new command line arguments via plugins); which is why, unfortunately, I have to nag upstream (sorry :) )

In any case, I hope I'll get some feedback on this proposal - and how difficult would it be to implement it in Nautilus proper. 

Thanks for reading, 
Cheers!
Comment 1 William Jon McCann 2012-09-05 13:22:14 UTC

*** This bug has been marked as a duplicate of bug 481823 ***
Comment 2 António Fernandes 2013-04-24 20:52:01 UTC
*** Bug 628683 has been marked as a duplicate of this bug. ***
Comment 3 António Fernandes 2013-12-18 21:25:26 UTC
*** Bug 720651 has been marked as a duplicate of this bug. ***
Comment 4 Tom Colley 2014-04-03 10:17:29 UTC
I note that this "bug has been marked as a duplicate of bug 481823", and that bug is marked as RESOLVED DUPLICATE. However, the core request for this bug, as I interpret it, is in the first paragraph of the reporters statement: 

"Nautilus should be able to open a set of folder locations as tabs in a window from the command line."

With all due respect and appreciation for the developers of Nautilus, this request does not appear to have been created as of version 3.8.2. The requested functionality is clearly of interest to many users for some time. See: 

http://www.answeredubuntu.com/26042/can_a_single_nautilus_window_be_started_with_multiple_tabs#sthash.H9rsPvlE.SHcR4vBf.dpbs
http://askubuntu.com/questions/55656/open-nautilus-as-new-tab-in-existing-window
http://askubuntu.com/questions/26042/can-a-single-nautilus-window-be-started-with-multiple-tabs
http://superuser.com/questions/140694/how-to-open-some-location-in-new-tab-in-existing-nautilus-window-from-console

So, can we get this request opened again? I'd love to see this functionality!!!
Comment 5 António Fernandes 2014-04-03 16:42:12 UTC
(In reply to comment #4)
This bug report is currently open.

It has indeed been marked as a duplicate at the time of comment #1, but was later reopened at the time of comment #2. I should have made it clear that I was making the change.

Sorry for the miscommunication.
Comment 6 António Fernandes 2018-02-07 09:20:50 UTC
Discussion continues on GitLab https://gitlab.gnome.org/GNOME/nautilus/issues/103