Description: xdg-mime reads from .config/mimeapps.list but never writes to it. Author: Chad MILLER Forwarded: no Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1518053 --- a/scripts/xdg-mime.in +++ b/scripts/xdg-mime.in @@ -239,13 +239,17 @@ make_default_generic() # $1 is vendor-name.desktop # $2 is mime/type # Add $2=$1 to XDG_DATA_HOME/applications/mimeapps.list + xdg_user_dir="$XDG_DATA_HOME" [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" - default_file="$xdg_user_dir/applications/mimeapps.list" - DEBUG 2 "make_default_generic $1 $2" - DEBUG 1 "Updating $default_file" - [ -f "$default_file" ] || touch "$default_file" - awk -v mimetype="$2" -v application="$1" ' + xdg_config_home="$XDG_CONFIG_HOME" + [ -n "$xdg_config_home" ] || xdg_config_home="$HOME/.config" + + for default_file in "$xdg_user_dir/applications/mimeapps.list" "$xdg_config_home/mimeapps.list"; do + DEBUG 2 "make_default_generic $1 $2" + DEBUG 1 "Updating $default_file" + [ -f "$default_file" ] || touch "$default_file" + awk -v mimetype="$2" -v application="$1" ' BEGIN { prefix=mimetype "=" indefault=0 @@ -293,6 +297,7 @@ make_default_generic() } } ' "$default_file" > "${default_file}.new" && mv "${default_file}.new" "$default_file" +done } search_desktop_file()