Last active
December 12, 2023 22:40
-
-
Save wwwehr/dbcb3e7b47c63602a6ebff886ea87cd7 to your computer and use it in GitHub Desktop.
Melodics URL xdg-open handler for Linux + Lutris
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
LAUNCH_HANDLER="run-melodics-with-scheme.sh" | |
XDG_DESKTOP_FILE="melodics-launcher.desktop" | |
GAME_ID=$(lutris -l | grep -i melodics | awk '{print $1}') | |
DYN_SCRIPT=$(mktemp) | |
lutris -b "$DYN_SCRIPT" "$GAME_ID" | |
awk 'NR>1{print prev} {prev=$0} END{print $0 " \"$1\""}' "$DYN_SCRIPT" >"$LAUNCH_HANDLER" | |
chmod +x "$LAUNCH_HANDLER" | |
cat <<EOF >"$XDG_DESKTOP_FILE" | |
[Desktop Entry] | |
Name=Medlodics Launcher | |
Exec=$(realpath $LAUNCH_HANDLER) %u | |
Type=Application | |
Terminal=false | |
MimeType=x-scheme-handler/melodics; | |
EOF | |
xdg-desktop-menu install "$XDG_DESKTOP_FILE" | |
xdg-mime default "$XDG_DESKTOP_FILE" x-scheme-handler/melodics | |
echo "🥁 Login callback handler installed! Lutris + Melodics is READY TO ROCK 🎹" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment