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)

Bruno Pereira
  • 74,715
Peter.O
  • 25,251

3 Answers3

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).

Isaiah
  • 60,750
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.

wag
  • 338
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.

mook765
  • 18,644