diff options
Diffstat (limited to 'generate-multimc-desktop-files')
-rwxr-xr-x | generate-multimc-desktop-files | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/generate-multimc-desktop-files b/generate-multimc-desktop-files new file mode 100755 index 0000000..a16be8c --- /dev/null +++ b/generate-multimc-desktop-files @@ -0,0 +1,32 @@ +#!/bin/bash + +echo "Deleting old .desktop files" +rm ~/.local/share/applications/multimc-*.desktop + +echo "Seeking instances" +for instdir in ~/.local/share/multimc/instances/*; do + if [[ (-d "$instdir") && (-f "$instdir/instance.cfg") ]]; then + echo "Scanning $instdir" + instanceid="$(basename -- "$instdir")" + name="$instanceid" + while IFS="=" read -r key value; do + case "$key" in + name) + echo "Instance Name: $value" + name="$value" + ;; + esac + done <"$instdir/instance.cfg" + cat <<EOF > "$HOME/.local/share/applications/multimc-$instanceid.desktop" +[Desktop Entry] +Name=MultiMC: $name +Type=Application +Categories=Game +StartupWMClass=multic +Terminal=false +Comment=Open MultiMC Instancew +GenericName=Minecraft +Exec=$(which multimc) -l "$instanceid" +EOF + fi +done |