#!/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 <