# Create desktop launcher file desktop_launcher() { local desktopFile="${HOME}/audiogame-manager.desktop" if [[ -e "${desktopFile}" ]]; then echo "the file ${desktopFile} exists. Cannot create the launcher." exit 1 fi local dotDesktop local terminal # Try to find an accessible terminal for i in mate-terminal lxterminal terminator gnome-terminal ; do if command -v $i &> /dev/null ; then terminal="$i" break fi done dotDesktop=('[Desktop Entry]' 'Name=Audiogame manager' 'GenericName=Audiogame Manager' 'Comment=Play audio games' "Exec=${terminal} -t \"Audiogame Manager\" -e \"/usr/bin/bash -c 'nohup $(readlink -e "$0") 2> /dev/null'\"" 'Terminal=false' 'Type=Application' 'StartupNotify=false' 'Keywords=game;' 'Categories=Game;' 'Version=1.0') for i in "${dotDesktop[@]}" ; do echo "$i" >> "${desktopFile}" done desktop-file-install --dir "${HOME}/.local/share/applications" -m 755 "${desktopFile}" xdg-desktop-icon install ~/.local/share/applications/audiogame-manager.desktop rm "${desktopFile}" exit 0 }