19
submitted 4 hours ago* (last edited 4 hours ago) by tinkralge@programming.dev to c/linux@programming.dev

Before I go off an write something myself, many things we open from our apps are HTTP/S URLs and they go straight to the browser. On Android, it's possible to assign apps to certain domains. I know I could write a script to do the same in linux, but my question is if there is a solution that already does this.

For those who don't know how, here's a superuser page that explains how to handle custom protocols.

This is what I use for now to open videos directly in mpv instead of a browser

~/bin/open-http.sh

#!/usr/bin/env bash
set -eu
# install with `xdg-mime default http-handler.desktop x-scheme-handler/http`
#              `xdg-mime default http-handler.desktop x-scheme-handler/https`
# is https and supported by yt-dlp
if [[ "$1" == "https://"* ]] && yt-dlp --simulate "$1" ; then
    exec mpv "$1"
else
    librewolf "$1" 
fi

http-handler.desktop

[Desktop Entry]
Comment=
Exec=~/bin/open-http.sh %u
MimeType=x-scheme-handler/https;
Name=HTTP Scheme Handler
NoDisplay=false
Path=
PrefersNonDefaultGPU=false
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=

A GUI or just config file would be great.

you are viewing a single comment's thread
view the rest of the comments
[-] possiblylinux127@lemmy.zip 1 points 3 hours ago* (last edited 3 hours ago)

You can change the default apps in the default apps menu

To test you can run XDG-open on a URL or file

this post was submitted on 18 Aug 2026
19 points (100.0% liked)

Linux

14711 readers
201 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 3 years ago
MODERATORS