diff options
author | nea <romangraef@gmail.com> | 2022-01-13 00:01:56 +0100 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-01-13 00:01:56 +0100 |
commit | d9031203e22e4ef381c482b4594521323647487e (patch) | |
tree | 1ea7dcfb53840a42f10d19cf25317138e497911a /generate-multimc-desktop-files | |
download | scripts-d9031203e22e4ef381c482b4594521323647487e.tar.gz scripts-d9031203e22e4ef381c482b4594521323647487e.tar.bz2 scripts-d9031203e22e4ef381c482b4594521323647487e.zip |
Initial commit
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 |