#!/bin/sh -efu # Change the default application for all file types from mplayer to celluloid cfile="/usr/share/applications/io.github.celluloid_player.Celluloid.desktop" mimeappsfile="/usr/share/applications/mimeapps.list" mimeappslocalfile="/etc/skel/.config/mimeapps.list" if [ -f "$cfile" -a -f "$mimeappsfile" ] then echo "[Default Applications]" > "$mimeappslocalfile" sed '/[=;]mplayer.desktop/!d ; /[=;]mplayer.desktop/s/=.*/=io.github.celluloid_player.Celluloid.desktop;/' "$mimeappsfile" >> "$mimeappslocalfile" echo "" >> "$mimeappslocalfile" echo "[Added Associations]" >> "$mimeappslocalfile" sed '/[=;]mplayer.desktop/!d ; /[=;]mplayer.desktop/s/=.*/=io.github.celluloid_player.Celluloid.desktop;/' "$mimeappsfile" >> "$mimeappslocalfile" fi