Show HN: TUI for managing XDG default applications
83 points
7 hours ago
| 6 comments
| github.com
| HN
Author here. I made this little TUI program for managing default applications on the Linux desktop.

Maybe some of you will find it useful.

Happy to answer any questions.

sourcegrift
6 hours ago
[-]
No one on earth has so far managed to get xdg default apps work on Linux. I've been failing since 19 years personally. If you've really succeded then congratulations!
reply
nickjj
5 hours ago
[-]
> No one on earth has so far managed to get xdg default apps work on Linux.

I've only been using Linux for a few weeks but what am I missing here?

I set a bunch of mime types in `~/.config/mimeapps.list` which are assigned to desktop apps and they all open perfectly with `xdg-open` or when I launch them through a file manager.

It is documented in the XDG specification https://specifications.freedesktop.org/mime-apps/latest/file....

reply
sam_lowry_
1 hour ago
[-]
> what am I missing here?

There are gotchas, for instance Chrom,{e,ium} insists on XDG_DESKTOP_DIR != XDG_DOWNLOAD_DIR.

See this bug report from a confused user: https://issues.chromium.org/issues/41076564

reply
mikkupikku
7 minutes ago
[-]
> also of note, we (mostly) don't allow ~/Desktop as the download dir for security reasons

This isn't an XDG issue. It's a chromium engineers being silly pricks that think they know better than the power users who obviously went out of their way to create such a configuration. Also I bet it would work if you set your XDG_DESKTOP_DIR to ~/Download/

reply
forgotpwd16
5 hours ago
[-]
For me currently, when trying to open a `text/markdown` file, there's a disassociation between what my file manager (Caja) runs (own bin/emacs script; was under the impression it was auto-creating a .desktop file), what mimeapps.list have (emacs.desktop), and what `xdg-open` runs (Firefox for some reason).
reply
TingPing
57 minutes ago
[-]
Older desktops don’t follow the specs and xdg-open does different things based on the desktop, so they indeed can get out of sync.

I’d have to look into your specific case but `gio mime` and `gio open` do the right things.

reply
saturn_vk
2 hours ago
[-]
Great. I must be living on the moon then. I guess gnome work great there since it manages this part
reply
mitjafelicijan
2 hours ago
[-]
Gnome has done an amazing job at this, I agree. You don't even notice this issue.
reply
mitjafelicijan
4 hours ago
[-]
I probably haven't. :) They are a nightmare indeed. But it does help a little.
reply
fouc
2 hours ago
[-]
At first I thought it was going to be some kind of solution to force all linux apps to adhere to the XDG Base Directory Specification, until I realized this related to a different specification altogether (XDG MIME Applications specification).
reply
jedahan
1 hour ago
[-]
Making home read-only can get there, and I can't find the project that forced using XDG paths. I think it used LD_PRELOAD or somesuch trick.

edit: https://soc.me/standards/defending-home

reply
jwrallie
5 hours ago
[-]
Just by reading the title, I’m sold! This should be very useful specially if you are not using a desktop environment that manages the default apps.

I always alias open to xdg-open, it’s so useful to open a file directly from the terminal.

reply
mitjafelicijan
4 hours ago
[-]
That was the exact reason for it. I made my own window manager for fun and was missing a simple way of changing default apps.
reply
ranger_danger
5 hours ago
[-]
Feature suggestion: The ability to add/remove more specific mime entries such as video/mp4
reply
mitjafelicijan
4 hours ago
[-]
I haven't thought about this. That makes sense. I will add this.
reply
roman_soldier
5 hours ago
[-]
Nice, but problem with all these AI coded TUI's is we will have hundreds of them, best to stick to the built in linux commands, add aliases/abbreviations (fish) if required, do you need a TUI for everything? Sometimes the answer to "Should I write this?" Is no
reply
mitjafelicijan
2 hours ago
[-]
I do agree with some of your sentiment. But by that logic, nothing would ever be made.

The same goes with aliases. Why not just use the actual commands. You give it your best shot, and sometimes something good comes out. And sometimes it's crap. That's life.

And I made it for fun and to learn something. And it wasn't AI coded. It's like 200 lines. I wanted to learn termbox2.h a bit more than I already had.

reply
wolttam
2 hours ago
[-]
Let people make and use what they want, you don’t have to use it.
reply
samtrack2019
1 hour ago
[-]
reading the code, what make you think it was vibe coded?
reply
untech
6 hours ago
[-]
Looks neat!
reply