From 3ffca01c5a93da979d3e7358a655f25a2aeb8966 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 10 May 2020 16:31:24 +0200 Subject: [PATCH] systemd: move XDG MIME defaults to a script --- bin/xdg-defaults | 25 +++++++++++++++++++++++++ systemd/misc-x@.service | 11 +---------- 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100755 bin/xdg-defaults diff --git a/bin/xdg-defaults b/bin/xdg-defaults new file mode 100755 index 0000000..505a2d1 --- /dev/null +++ b/bin/xdg-defaults @@ -0,0 +1,25 @@ +#!/bin/sh + +# Set default MIME type for XDG. Linux desktop is a bit painful around +# that. Random applications register for any MIME type and the default +# is always surprising. + +set -e + +while read desktop mimetypes; do + for dir in ~/.local/share/applications /usr/local/share/applications /usr/share/applications notfound; do + [ -f "$dir"/"$desktop" ] || continue + echo "Set default for $mimetypes to $desktop" + xdg-mime default $desktop $mimetypes + break + done + [ "$dir" != "notfound" ] || echo "Application $desktop not found" +done <