You are not logged in.

#1 2024-12-29 12:44:28

hully
Member
Registered: 2022-11-14
Posts: 164

Contradictory mime type

Consider the following output:

➜  file --mime-type paper.html
paper.html: text/html

❯ handlr mime paper.html 
┌────────────┬───────────┐
│ path       │ mime      │
├────────────┼───────────┤
│ paper.html │ text/html │
└────────────┴───────────┘

➜  xdg-mime query filetype paper.html 
application/xhtml+xml

I want Dolphin (the KDE file manager) to show custom entry in the "Open With" sub-menu of the right click context menu.

If, in my custom .dekstop file under ~/.local/share/applications, I use "text/html" mime type, the custom entry is not shown.

If instead I use "application/xhtml+xml" it is shown.

Why xdg-mime returns a different result than file, and where it is documented that Dolphin uses xdg-mime and not file?

Offline

#2 2024-12-29 14:05:31

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,041

Re: Contradictory mime type

man file wrote:

-i, --mime
               Causes the file command to output mime type strings rather than the more traditional human readable ones.   Thus  it
               may say ‘text/plain; charset=us-ascii’ rather than “ASCII text”.

       --mime-type, --mime-encoding
               Like -i, but print only the specified element(s).

Note that graphical applications use xdg mime applications, but console apps have their own method to link types and actions .

https://wiki.archlinux.org/title/Default_applications and https://wiki.archlinux.org/title/XDG_MIME_Applications should help to get an idea how things work


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-01-02 19:44:32

hully
Member
Registered: 2022-11-14
Posts: 164

Re: Contradictory mime type

Thanks for the explanation.

Was very useful.

Offline

#4 2025-01-02 20:40:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,661

Re: Contradictory mime type

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Online

Board footer

Powered by FluxBB