rodlie / qtfm

Qt File Manager
https://qtfm.eu
GNU General Public License v2.0
156 stars 43 forks source link

Alternative to dot desktop #69

Open karabaja4 opened 5 years ago

karabaja4 commented 5 years ago

Hello, I have an issue with qtfm 6.1.2. When I set a mime type for a certain mime (application/pdf), it resets to the default value when I restart qtfm.

For example, set mupdf launcher for mime application/pdf. When you open a PDF, it works. Restart qtfm, the mupdf won't be in the list.

rodlie commented 5 years ago

Hi,

I'm not able to reproduce this issue.

karabaja4 commented 5 years ago

i)

[igor@laptop ~]$ cat ~/.local/share/applications/mimeapps.list|grep "application/pdf"
application/pdf=libreoffice-draw.desktop;inkscape.desktop

So yeah, it always reverts to libreoffice-draw and inkscape.

ii) It was not in the list, I had to add it. It also was not in the application list when I browsed through the apps tree when I wanted to add it. So I wrote "mupdf" in the Launcher input textbox and added it.

By the way, /usr/share/applications/mupdf.desktop exists and has a category defined as Categories=Viewer;Graphics; which is not in the list.

iii) No. I am running a very clean (Arch Linux) Openbox system with minimal daemons.

iv) It did not work on 6.1.0. Prior to that I don't know.

rodlie commented 5 years ago

Thanks for the information.

The mime list only supports .desktop applications. So if the application is not in the apps tree you can't use it. The "Launcher" should not even be there in the settings since you can't assign a non-.desktop app to the list.

But if you have mupdf.desktop is should exist in the tree. Could you paste the complete mupdf.desktop here?

karabaja4 commented 5 years ago
[Desktop Entry]
Name=MuPDF
GenericName=PDF file viewer
Exec=mupdf %f
TryExec=mupdf
Icon=mupdf
Terminal=false
Type=Application
MimeType=application/epub+zip;application/pdf;application/x-pdf;application/x-cbz;application/oxps;application/vnd.ms-xpsdocument;image/jpeg;image/pjpeg;image/png;image/tiff;image/x-tiff
Categories=Viewer;Graphics;
Actions=View
NoDisplay=true
[Desktop Action View]
Name=View with mupdf
Exec=mupdf %f
rodlie commented 5 years ago

Ahh, look at the NoDisplay value. Apps that defines NoDisplay=true are ignored.

karabaja4 commented 5 years ago

Ahh. That was the issue. I removed it and it works now, thanks.

It's really a shame that not all apps are setup correctly with the mime types and *.desktop files. Would you consider adding some kind of alternative to mime types, which has been a mess on Linux since forever? For example, if I had a choice, I would not use mime types at all, since most of the files have extensions. It would be great to just define a command to use to open certain files with specific extensions. Just a suggestion :)

Thanks again for your help.

Regards,

Igor

rodlie commented 5 years ago

An alternative should not be that hard, but it will of course be for qtfm-only. The reason I use .desktop is to be compatible with everything else.

I'm open for all suggestions regarding qtfm7, since I will re-write most of it anyway.

imrn commented 5 years ago

Linux applications and mimetypes are a mess, but they are still better than nothing. I think, a convenient way to override them is the way to go.

qtfm only allows registered applications to be selected for default mime actions. However, I'd like to provide custom commands for the override.

May be, you can rethink/merge "Custom Actions," "Mime Types" settings.

As l also want to manage my desktop with qtfm (#100) this would be my perfect tiny desktop environment.

rodlie commented 5 years ago

I will add a custom app "manager" as an alternative to dot desktop, but not until v7.

anilsg commented 1 year ago

I previously did not find this issue when I searched, and as a result I opened the following issue by mistake: https://github.com/rodlie/qtfm/issues/190

It's pretty much a duplicate. I guess I will close issue #190 but leave it there for reference, as my description of how this appears to users and affects them is more detailed.

I agree that the existing mime types implementation is good enough, or at least "the only one" available for support.

I understand the desktop specification explicitly states that "hidden" actually means "deleted" or equivalent to "just not there": https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

I'll certainly pay more attention to this in future, and I'm not sure why MuPDF was installed in that manner.

QtFM would not be complying with the desktop specification if it did allow hidden entries to be used, so I think it's "correct" that QtFM should use the next available entry instead of a preceding hidden entry. However, I would argue that it is an additional step, outside of the specification, to actively prune / clean hidden entries.

I would have thought that individual applications should not take it upon themselves to actively "lint" and "correct" shared user configuration files that are there for all the user's applications. If the user really wanted that entry deleted, they could have deleted the entry, but they didn't, they left it "hidden", therefore the "correct" treatment would be to leave it hidden, and to continue to treat it as hidden.

QtFM has the option to just avoid using any hidden desktop entries for it's own behaviour, but without over-writing the file. I believe there are desktop linters available that will scan the configuration and identify orphaned desktop files, etc.

Doing this would be even more silent than the current behaviour, but I still argue for mentioning this little gotcha in the documentation somewhere.

Thanks