xdg-open

Hi folks,

Is there a rant section in this forum? I have just discovered xdg-open riding on my FreeBSD 10 system. This abomination. Midnight Commander has suddenly decided to ignore my settings and use xdg-open to decide which application to open a file with. So all PDF files are now going to Firefox - yes, the whole damn web browser, and not my lovely little mupdf. The configuration structure of this abysmal piece of software is worse than the Windows Registry! Oh almighty, why, why this is happening to us?
 
According to xdg-settings(1), xdg-open simply allows the terminal to inherit the desktop's settings. So the settings must exist in your DE/WM somewhere for xdg-open to use them. If I xdg-open a PDF, it is opens using xpdf, which is the same behavior my Xfce has.
 
Thanks, SirDice. I will try it. DutchDaemon, the thing is, I don't have a DE. I'm using dwm. I know it defaults to something and there's a syntax to change that, but I want simplicity in life. :)
 
Haha, the old xdg-open insanity. It happened to me, too, and I got interested in it. I used Chrome at that time and PDFs were always opened by Firefox that forwarded it to the real application. I opened the script and found the following "logic":

Check if $BROWSER is set. If yes, use it to open the PDF file, if it is not set, open firefox with the PDF.

It was a big laugh for me. I asked myself if it was also invented by Mr Poettering. He is a member of this project, as I can see.
 
There are some drop-in replacements: https://wiki.archlinux.org/index.php/Xdg-open#Drop-in_replacements_and_useful_tools.
I don't know which ones work on FreeBSD, and I have not used at any of them. I just know some exist.

XDG is, by the way, one of those things that's basically a good idea, but with some (unfortunate) flaws.

It was a big laugh for me. I asked myself if it was also invented by Mr Poettering. He is a member of this project, as I can see.

XDG is from freedesktop.org, which is a Red Hat thing; Red Hat seems to be the source of many of these sort of, dubious, utilities. Poettering works for Red Hat.
 
Hi,

I know it defaults to something and there's a syntax to change that, but I want simplicity in life. :)
It's simple to change that. First you need a desktop file, because mupdf does not install one.

Code:
[cmd=$]cat > ~/.local/share/applications/mupdf.desktop[/cmd]
[Desktop Entry]
Type=Application
Terminal=false
Exec=/usr/local/bin/mupdf
Name=mupdf
#Icon=/usr/local/share/icons/Faenza/apps/scalable/AdobeReader10.svg
Then run the following command: $ xdg-mime default mupdf.desktop application/pdf.

HTH.
 
Back
Top