14

The ability of a .desktop file to display a "human-readable" alias rather than its (perhaps) clinical real name, has merit... and as the .desktop filetype suggests, I assume that this ability is intended for the Desktop (which is (co-?)managed by Nautilus).

However in the Nautilus File Manager itself, where I would expect to see the bare-bones file information (eg. the real name), I am presented with the meta-data alias instead of the real filename.

This makes it rather difficult to edit/view the .desktop file when Nautilus does not make the real name available.

Is there some way to have Nautilus GUI File Manager list these .desktop files by their real names? (just like ls)

PS.. These files had me completely puzzled until today, when I renamed one, and the (my) new "name" was actually not the new real filename at all!. The displayed name was an alias; Nautilus had modified the file's contents (Name=...), and the original name was unchanged! ... now I am only half-puzzled (strange stuff)

5
  • Sounds Like a challenge for a nautilus script! maybe a mod of filetype script?
    – Allan
    Dec 13, 2010 at 16:46
  • 2
    ...actually, the more I think about it, the stranger it seems. When a standard "rename" feature actually modifies a file's contents, that's going beyond the call of duty, as far as I'm concerned... Well, at least that's not what I expect of a File Manager... I thought that was what File Editors (and Property Sheets) were for... and yes, a Nautilus script will allow me to edit/view the file... But I still wonder what is so "special" about .desktop files that Nautilus gives them such "special" treatment.. treatment which is quite non-standard for file "Manager".
    – Peter.O
    Dec 13, 2010 at 18:13
  • I cant really see why it wouldn't be possible to rename it to the package it relates to as by default packages should have a unique name. With maybe an Identifier for multiple entries Prism Launcher for instance. Can't check an example at the mo been confined to a Windows vista Box....... (cries in to Coffee)
    – Allan
    Dec 13, 2010 at 18:43
  • What version of nautilus are you using?
    – Isaiah
    Dec 13, 2010 at 21:11
  • @DoR. You've spotted the problem "just like that!"... I'm using Nautilus 2.30.1 (Lucid 10.04)... I've just now tried Nautilus 2.32.0 in a VM version of 10.10, and it works; the new name does now appear in the ls listing... I had tried Maverick in a VM within a fortnight of it being released, but it crashed a couple of times, and being very new to Linux/Ubuntu, I decided to hold off until I'd learnt enough to be able to deal with a potential install drama.. This has been a "sign!"..I may be switching sooner than I expected ...and now, all I need is an answer so I can mark it "solved" :)
    – Peter.O
    Dec 14, 2010 at 1:10

3 Answers 3

5

With newer versions of Nautilus (2.31.5 and later) renaming .desktop files actually changes the filename, not the Name field of the file itself.

Nautilus will show the full filename (with the .desktop extension), if the .desktop file is not executable.

For example, if Firefox.desktop is executable:

alt text

Now to see the actual filename, make Firefox.desktop un-executable. Right click -> Properties -> Permissions -> Uncheck Allow executing file as a program.

alt text
Now Nautilus will show the full file name:

alt text

alt text There seems to be a bug with renaming un-executable .desktop files in Nautilus.
If you don't erase the .desktop extension, the file will
have a double-extension (i.e Firefox.desktop.desktop).

4
  • 1
    Thanks DoR... In amongst the side issues, I somehow lost sight of my original question ... ie. Can Nautilus show the "real filename"? ...I think it is clear now... Nautilus does what it does!... and that is: It always shows the alias name... Now that I know this, whenever I want the real filename, I can use a Nautilus Script... (It seems that using ls will be a "best-guess" method, because the real name may be significantly different).
    – Peter.O
    Dec 14, 2010 at 6:19
  • @fred.bear Edited my answer ;)
    – Isaiah
    Dec 14, 2010 at 6:50
  • Yes! .. I was getting that double .desktop! ...quite puzzling.. (and another gremlin, but there's no point going into it... in normal usage it works fine.. and I now know what to expect :)
    – Peter.O
    Dec 14, 2010 at 8:50
  • 1
    quote: "Nautilus will show the full filename, if the .desktop file is not executable." This behaviour is so unbelievable! The first request I have from a file manager is to SHOW me the name of a file, not some other information, WHATEVER the type of of the file is.
    – kebs
    Jun 18, 2013 at 7:44
2

Apart from nautilus' strangeness, here's a nautilus script.

You can select multiple files, click ok and gedit will show them (requires zenity).

#!/bin/sh

FILE=$(ls -1 | zenity --list --hide-header --multiple --separator "\n" --title "List directory contents" --width 400 --height 300 --column "ls")
IFS="
"
test -z "$FILE" || gedit $FILE

Put it in ~/.gnome2/nautilus-scripts and make it executable.

1
  • Thanks for the suggestion... I have previously used Nautilus Actions, but you've propted me to take a look a Nautilus Scripts, and I like it! ... and I also like the dialog interface of zenity
    – Peter.O
    Dec 14, 2010 at 1:15
0

We can display the real file names in Nautilus without making use of additional scripts.

Nautilus will display the alias of a .desktop-file for .desktop-files which are located in /usr/share and /usr/local/share including all sub-directories of both directories. Nautilus will display the real file-name if the .desktop-file is located anywhere else.

We can do a simple trick with a symbolic link:

sudo ln -s /usr /USR

If we browse in Nautilus to /usr/share/applications, Nautilus will display the aliases for the .desktop-files.

If we browse in Nautilus to /USR/share/applications, Nautilus will display the real file-names of the .desktop-files.

Try it, I tested this on several Ubuntu-flavours with the versions 16.04 and 17.04. This also works in Xubuntu, Thunar has the same behavior as Nautilus.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .