# How do you get xdg-mime to use mime types in /usr/share/mime/?

**URL:** <http://forum.hypr.land/t/how-do-you-get-xdg-mime-to-use-mime-types-in-usr-share-mime/951>\
**Category:** Bugs / FRs / Support\
**Tags:** question, help, xdph, other\
**Created:** [October 3, 2025, 2:39pm UTC](http://forum.hypr.land/t/how-do-you-get-xdg-mime-to-use-mime-types-in-usr-share-mime/951 "2025-10-03T14:39:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darth\_mall](http://forum.hypr.land/user_avatar/forum.hypr.land/darth_mall/32/830_2.png) [@darth\_mall](http://forum.hypr.land/u/darth_mall)\
**Post date:** [October 3, 2025, 2:39pm UTC](http://forum.hypr.land/t/how-do-you-get-xdg-mime-to-use-mime-types-in-usr-share-mime/951/1 "2025-10-03T14:39:45Z")

</div>

> **Hyprland version**
>
> ```auto
> Hyprland 0.51.1 built from branch at commit 71a1216abcc7031776630a6d88f105605c4dc1c9 ([gha] Nix: update inputs).
> Date: Mon Sep 22 20:54:03 2025
> Tag: v0.51.1, commits: 6436
> built against:
> aquamarine 0.9.4
> hyprlang 0.6.3
> hyprutils 0.8.4
> hyprcursor 0.1.13
> hyprgraphics 0.1.6
> 
> ```

I can’t figure out how to get `xdg-mime` to recognize markdown files as `text/markdown`, it keeps returning `text/plain`:

```bash
> XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query filetype README.md (main)

Running file --brief --dereference --mime-type "/home/evan/Code/darthmall.net/README.md"
text/plain

```

Based on [this stackoverflow answer](https://unix.stackexchange.com/a/9874), this output makes me think XDG is falling back on `file` instead of using the mime types in `/usr/share/mime/`, though I’m not sure why. I have installed `xdg-destkop-portal-hyprland` and have tried running hyprland with and without `uwsm`.

Any pointers on how to get `xdg-mime` to give me the correct mime type for markdown files would be appreciated.

---

<div class="post-metadata">

**Author:** ![frostbite](http://forum.hypr.land/letter_avatar_proxy/v4/letter/f/c89c15/32.png) [@frostbite](http://forum.hypr.land/u/frostbite)\
**Post date:** [October 7, 2025, 10:59am UTC](http://forum.hypr.land/t/how-do-you-get-xdg-mime-to-use-mime-types-in-usr-share-mime/951/2 "2025-10-07T10:59:13Z")

</div>

/usr/share/mime/packages/freedesktop.org.xml already has definition for text/markdown. I am still not sure why xdg-mime is returing text/plain. You can instead use [handlr-regex](https://github.com/Anomalocaridid/handlr-regex) , for me it returns text/markdown.

~/.config/mimeapps.list →  
[Added Associations]  
text/markdown=org.kde.ghostwriter.desktop;

---

<div class="post-metadata">

**Author:** ![frostbite](http://forum.hypr.land/letter_avatar_proxy/v4/letter/f/c89c15/32.png) [@frostbite](http://forum.hypr.land/u/frostbite)\
**Post date:** [October 16, 2025, 3:06am UTC](http://forum.hypr.land/t/how-do-you-get-xdg-mime-to-use-mime-types-in-usr-share-mime/951/3 "2025-10-16T03:06:22Z")

</div>

@darth_mall found it , look at this [xdg-utils - ArchWiki](https://wiki.archlinux.org/title/Xdg-utils#xdg-mime) and install [perl-file-mimeinfo](https://archlinux.org/packages/?name=perl-file-mimeinfo)
