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 708533 - When opening URI, allow to select file via fragment, e.g. "file:///etc#hostname"
When opening URI, allow to select file via fragment, e.g. "file:///etc#hostname"
Status: RESOLVED INVALID
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-21 14:53 UTC by Robin Stocker
Modified: 2016-03-01 18:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for interpreting fragment of file URI as file to select (2.01 KB, patch)
2013-09-21 14:55 UTC, Robin Stocker
none Details | Review

Description Robin Stocker 2013-09-21 14:53:16 UTC
Currently, when opening an URI like "file:///etc#hostname", a window with the etc folder is shown. It would be very handy if the fragment (if present) is interpreted to mean "select the file in the resulting window".

Now you may ask: Why would this be useful, when Nautilus already provides the functionality by just calling "nautilus /etc/hostname" directly?

The usefulness is that the URI approach also works through gvfs-open (and xdg-open) and results in Nautilus showing the file:

When calling "gvfs-open /etc/hostname", the result is that the file is opened in a text editor.

When calling "gvfs-open 'file:///etc#hostname'", the file is shown in the file manager. If a file manager does not interpret the fragment, it just shows the folder without selecting the file, which is also OK and backwards-compatible.

Patch upcoming.
Comment 1 Robin Stocker 2013-09-21 14:55:55 UTC
Created attachment 255485 [details] [review]
patch for interpreting fragment of file URI as file to select
Comment 2 Nelson Benitez 2013-09-29 13:47:22 UTC
If you want to open a folder and select a file in it, in a desktop agnostic way, instead of using gvfs-open or xdg-open you should use the DBus file manager interface[1].

You can call it from a terminal using dbus-send, this example will open and select your /etc/hostname file:

dbus-send --print-reply --dest=org.freedesktop.FileManager1  \
          /org/freedesktop/FileManager1           \
          org.freedesktop.FileManager1.ShowItems  \
          array:string:"file:///etc/hostname"     \
          string:''


[1] http://www.freedesktop.org/wiki/Specifications/file-manager-interface/
Comment 3 Robin Stocker 2013-09-29 14:26:15 UTC
Thanks for the information, but I know about the DBus interface.

The nice thing about supporting this in the URI format is that it will also work e.g. when the URI is printed on the terminal or sent via mail, etc. Write this in the terminal and ctrl-click on it:

file:///etc/#hostname

It will currently just show /etc. With the patch it will also select the file.
Comment 4 Carlos Soriano 2016-03-01 18:46:46 UTC
Thanks for the patch Robin.
I think we don't want this, a file can have a # in its file name, we don't want to use it as something different or actually have code for that.

As said you can use dbus or directly nautilus (although I understand why you wouldn't)

So I'm going to close it.