You are not logged in.

#1 2022-01-24 07:50:14

mersh
Member
Registered: 2021-12-18
Posts: 18

[SOLVED] xdg-open launches default-web-browser no matter what protocol

I've been trying to configure xdg-utils for the past few weeks and this has been driving me insane. If I attempt to open a "mailto" or "gemini" link anywhere, it will open the link in my default web browser such as Brave or Firefox, rather than opening it in the default application associated with the mimetype.

# .config/mimeapps.list

[Default Applications]

application/postscript=pdf.desktop;
application/pdf=pdf.desktop;
image/png=img.desktop;
image/jpeg=img.desktop;
image/gif=img.desktop;
inode/directory=file.desktop
text/gemini=gemini.desktop;
text/plain=text.desktop;
text/x-shellscript=text.desktop;
video/x-matroska=video.desktop
x-scheme-handler/gemini=gemini.desktop;
x-scheme-handler/gopher=gemini.desktop;
x-scheme-handler/http=web.desktop;
x-scheme-handler/https=web.desktop;
x-scheme-handler/irc=chat.desktop;
x-scheme-handler/ircs=chat.desktop;
x-scheme-handler/mailto=mail.desktop;
x-scheme-handler/terminal=terminal.desktop;
x-scheme-handler/xmpp=chat.desktop;
# .local/share/applications/gemini.desktop

[Desktop Entry]
Type=Application
Name=Amfora
GenericName=Gemini Client
Exec=/usr/bin/amfora %u
Terminal=true
MimeType=x-scheme-handler/gemini;text/gemini
# .local/share/applications/mail.desktop

[Desktop Entry]
Type=Application
Name=Neomutt
GenericName=Mail Client
Exec=/usr/bin/neomutt %u
Terminal=true
MimeType=x-scheme-handler/mailto

I am using st as my terminal (and dwm as the window manager, if that matters), and I have symlinked /usr/local/bin/st to /usr/local/bin/xterm for (what I've understood) xdg-utils compatibility.

Last edited by mersh (2022-02-01 01:56:08)

Offline

#2 2022-01-25 19:53:02

ishaanbhimwal
Member
Registered: 2022-01-21
Posts: 48
Website

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

Offline

#3 2022-01-26 11:03:09

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,893

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

/usr/local/bin/st to /usr/local/bin/xterm

There are no archlinux packages that install stuff in /usr/local , you probably didn't use https://aur.archlinux.org/packages/st/ ?

please post output of

xdg-settings get default-url-scheme-handler mailto

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

Online

#4 2022-01-27 04:49:02

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

Lone_Wolf wrote:

/usr/local/bin/st to /usr/local/bin/xterm

There are no archlinux packages that install stuff in /usr/local , you probably didn't use https://aur.archlinux.org/packages/st/ ?

please post output of

xdg-settings get default-url-scheme-handler mailto

I don't use the st package, I compile my own st.

$ echo $BROWSER $TERMINAL
librewolf st

$ xdg-settings get default-url-scheme-handler mailto
mail.desktop

$ xdg-settings get default-web-browser
web.desktop
# .local/share/applications/web.desktop

[Desktop Entry]
Type=Application
Name=LibreWolf
GenericName=Web Browser
Exec=/usr/bin/librewolf %u
Terminal=false
MimeType=x-scheme-handler/http;x-scheme-handler/https

Offline

#5 2022-01-27 09:20:33

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,893

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

xdg-settings output looks fine.


I don't use the st package, I compile my own st.

A big part of the reason we have PKGBUILDs is to ensure programs that need adjustments to work correctly on archlinux are done.
The aur st package adds a patch and sets some compilation options .

Please post the PKGBUILD you use for your local compilation.
In case you don't use  a PKGBUILD point us to the compiling instructions you followed.

Last edited by Lone_Wolf (2022-01-27 09:21:39)


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

Online

#6 2022-01-28 07:29:45

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

Lone_Wolf wrote:

xdg-settings output looks fine.


I don't use the st package, I compile my own st.

A big part of the reason we have PKGBUILDs is to ensure programs that need adjustments to work correctly on archlinux are done.
The aur st package adds a patch and sets some compilation options .

Please post the PKGBUILD you use for your local compilation.
In case you don't use  a PKGBUILD point us to the compiling instructions you followed.

What patches does the AUR package add?

This is the Git repository for my st build.
https://git.mersh.com/garretthoward/st

I have never used a PKGBUILD to install it. Am I supposed to?

Offline

#7 2022-01-28 13:14:08

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,893

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

It appies a terminfo patch, https://aur.archlinux.org/cgit/aur.git/ … patch?h=st

https://git.mersh.com/garretthoward/st looks like a fork without tags or releases that lags behind the original.
example : https://st.suckless.org/ shows 0.8.5 was released on jan 7, garrethoward version is 0.8.4  .

For systemwide installs it is recommended to use a PKGBUILD.
makepkg uses the PKGBUILD to create binary packages which can then be installed with pacman.

pacman knows what is in the package, allows for easy removal , keeps track of dependencies and is able to keep your installation consistent & maintained.

By building manually and installing to /usr/local you circumvent the package manager and block pacman from maintaining whatever is installed there.
This makes maintenance of your system nuch harder.

I have 18 personal packages on my system including development versions of llvm & mesa and a trimmed down version of libblockdev .

Using makepkg & pacman allows me to keep my system in good health and rocksolid despite changing big parts of it .

Incase I need help with issues I can post the PKGBUILD (or point to its aur/web page) and show exactly what is different on my system.
This helps tremendously with troubleshooting.


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

Online

#8 2022-01-28 22:04:11

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

If I attempt to open a "mailto" or "gemini" link anywhere

Define "anywhere" - there's no guarantee that "somewhere" (some browser?) actually cares much about xdg. Esp. if "somewhere" is "librewolf" - since it's not in the repos, how did you install it and is it a flatpak?

Offline

#9 2022-01-30 08:56:31

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

seth wrote:

If I attempt to open a "mailto" or "gemini" link anywhere

Define "anywhere" - there's no guarantee that "somewhere" (some browser?) actually cares much about xdg. Esp. if "somewhere" is "librewolf" - since it's not in the repos, how did you install it and is it a flatpak?

I've attempted to open those links from Firefox, Chromium, Librewolf (librewolf-bin from AUR), Brave (brave-bin from AUR), xdg-open (not in a terminal), and handlr (not in a terminal). They haven't worked.

Firefox and it's derivatives, although, do open a popup asking for which program to handle the file/URL with, allowing me to open "gemini" and "mailto" links through Librewolf. This doesn't fix the issue, because when I type xdg-open (not in a terminal), it opens the URL in Librewolf, which then asks what program to open the URL in.

Using the st package from the AUR didn't solve anything, at least for me.

Offline

#10 2022-01-30 10:09:20

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

Try to run "update-desktop-database" to update the cache, though iirc. at least the big DEs do that w/ every login anyway.

Offline

#11 2022-01-30 10:12:42

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

seth wrote:

Try to run "update-desktop-database" to update the cache, though iirc. at least the big DEs do that w/ every login anyway.

After running that command, xdg-open (not in terminal) still runs Librewolf rather than opening a url in my terminal.

Last edited by mersh (2022-01-30 10:13:46)

Offline

#12 2022-01-30 14:40:10

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

As you keep pointing that out "xdg-open (not in terminal)": is there a difference and where exactly is "not in a terminal"?

Offline

#13 2022-01-30 22:10:31

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

seth wrote:

As you keep pointing that out "xdg-open (not in terminal)": is there a difference and where exactly is "not in a terminal"?

I mean menu software such as bemenu, dmenu, and rofi. Sorry for the confusion.

When I open the URLs in a terminal, it opens the terminal software just as I want, but through the menu software listed above, it opens the URL in the browser.

Offline

#14 2022-01-30 22:13:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

[Desktop Entry]
Type=Application
Name=Neomutterm
GenericName=Mail Client
Exec=/usr/bin/xterm -e /usr/bin/neomutt %u
Terminal=false
MimeType=x-scheme-handler/mailto

Offline

#15 2022-02-01 01:55:32

mersh
Member
Registered: 2021-12-18
Posts: 18

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

seth wrote:
[Desktop Entry]
Type=Application
Name=Neomutterm
GenericName=Mail Client
Exec=/usr/bin/xterm -e /usr/bin/neomutt %u
Terminal=false
MimeType=x-scheme-handler/mailto

This finally got things working! Thanks for all of your help! I'll mark this as solved.

Last edited by mersh (2022-02-01 01:56:18)

Offline

#16 2022-02-01 07:30:47

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] xdg-open launches default-web-browser no matter what protocol

The reason is (apparently) that dmenu etc. resp. the backing script(s)  can't make use of desktop services that require it to start a  terminal process to run them.
You might want to research on that for a more general solution.

Offline

Board footer

Powered by FluxBB