xdg-mime-default.shon commit add sitemap generator (de26b28)
   1#!/bin/sh
   2# From https://blog.hexadust.net/xdg-open-setting-default-handler-for-supported-mime-types
   3D=$1
   4if test -z "$D"; then
   5 find /usr/share/applications/ ~/.local/share/applications/ -name '*.desktop' | while read DF; do
   6        D=`basename "$DF"`
   7      echo $D
   8     cat "$DF" | grep MimeType | cut -f2 -d= | tr ';' "\n" | grep -v '^$' | while read M; do
   9         echo -ne "\t$M current: "
  10            xdg-mime query default "$M"
  11     done
  12        echo
  13    done
  14fi
  15if test -n "$D"; then
  16 find /usr/share/applications/ ~/.local/share/applications/ -name "$D" | while read DF; do
  17       cat "$DF" | grep MimeType | cut -f2 -d= | tr ';' "\n" | grep -v '^$' | while read M; do
  18         echo "Using $D for $M"
  19          xdg-mime default "$D" "$M"
  20      done
  21    done
  22fi