helloSystem / Filer

A file manager that can also render the desktop
GNU General Public License v2.0
30 stars 9 forks source link

Document icons depending on which application opens a document #159

Open probonopd opened 1 year ago

probonopd commented 1 year ago

This is an absolutely dysfunctional atrocity.

ksnip_20221122-210354

Why is the document not showing clearly which application it will be opened with?

In my opinion, I am not interested in which data a file contains. I am interested in which application it is opened with. Different documents with the same data format may need to be opened with different applications (or even versions).

This has never worked in a "proper desktop" fashion on "Linux desktops". Possibly because the XDG standards don't even account for this.

Can it be that XDG doesn't even have the concept of document icons?

This is how it should be:

image

Yet where would the document icons be coming from?

The desktop file doesn't specify which documents it can open, nor what icon they should have:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Oracle VM VirtualBox
GenericName=Virtual Machine
Type=Application
Exec=VirtualBox
TryExec=VirtualBox
Icon=VBox
Categories=Emulator;System;
Comment=Run several virtual systems on a single host computer

Icon=VBox also gives no clue about where that icon might be hiding... or which version of it should be used.

Apparently XDG is not even allowing for the absolute bare essentials of a desktop to work properly, like having proper document icons.

Do we even have the document icon?

Users-Laptop% pkg list virtualbox-ose | grep png
/usr/local/share/pixmaps/VBox.png

Nope! Only the application icon!

As a last resort, we can generate document icons from application icons on the fly by combining a generic document icon like this

image

with a small version of the application icon.

Extra credits for giving the document a color similar to the dominant color in the application icon.

probonopd commented 1 year ago

In this case, the .vbox file wrongly has application/xml as the MIME type. We should also have an EASY way for apps to say that they can-open certain filename extensions.

probonopd commented 1 year ago

As pointed out rightfully by @ammdias@masto.pt:

the same document may be opened by different applications, depending on what you want to do with it. I may want to open an image with the image viewer, if I want to display it, or with an image editor like Gimp or MyPaint. The same for a music file, should it have a Audacious or Audacity icon? A text config file may be used by an application at launch but I may want to edit it with Vim in a terminal or Gedit in GNOME. In those cases, which application icon should the documents have?

The one of the application that gets to open it when the file is double-clicked. For that exact reason!

probonopd commented 1 year ago

The example above may be not the best one, as this may simply be the effect of the VirtualBox FreeBSD package lacking the icons (FreeBSD bug report), which, e.g., Fedora's RPMFusion virtualbox package and http://archive.ubuntu.com/ubuntu/pool/multiverse/v/virtualbox/virtualbox-qt_6.1.6-dfsg-1_amd64.deb make available in /usr/share/icons/hicolor/48x48/mimetypes.

image

Thanks @konradmb@mastodon.social for pointing this out.

This is the upstream location of these icons: https://github.com/Virtualbox-OSE/Virtualbox/tree/main/src/VBox/Artwork/other