From d1ca997ad28fa735db000ed4030af11346a00983 Mon Sep 17 00:00:00 2001 From: "s0wlz (Matthias Puchstein)" Date: Tue, 10 Mar 2026 12:48:44 +0100 Subject: [PATCH] added small hacky script to open youtube links always in mpv --- dot_local/bin/executable_xdg-https-handler | 10 ++++++++++ .../applications/private_xdg-https-handler.desktop | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 dot_local/bin/executable_xdg-https-handler create mode 100644 dot_local/share/applications/private_xdg-https-handler.desktop diff --git a/dot_local/bin/executable_xdg-https-handler b/dot_local/bin/executable_xdg-https-handler new file mode 100644 index 0000000..f28534d --- /dev/null +++ b/dot_local/bin/executable_xdg-https-handler @@ -0,0 +1,10 @@ +#!/bin/bash +BROWSER=firefox.desktop + +if [[ "$1" =~ ^https?://(www\.)?(youtube\.com/watch|youtu\.be)/ ]]; then + mpv "$1" +elif [[ "$1" =~ ^https?://(www\.)?(youtube\.com/shorts|youtu\.be)/ ]]; then + mpv "$1" +else + gtk-launch "$BROWSER" "$1" +fi diff --git a/dot_local/share/applications/private_xdg-https-handler.desktop b/dot_local/share/applications/private_xdg-https-handler.desktop new file mode 100644 index 0000000..4d45582 --- /dev/null +++ b/dot_local/share/applications/private_xdg-https-handler.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=HTTPS Handler +Exec=xdg-https-handler %u +Categroies=Network;WebBrowser; +NoDisplay=true +MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;text/xml;application/xhtml+xml;