Added flag to create a .desktop file so audiogame-manager can be launched from the desktop or applications menu.

This commit is contained in:
Storm Dragon 2022-01-01 16:12:22 -05:00
parent 772634750c
commit 55f15b234c

View File

@ -113,6 +113,41 @@ open_url() {
fi
}
# Create desktop launcher file
desktop_launcher() {
local desktopFile="${TMPDIR:-/tmp}/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 lxterminal mate-terminal 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} -e \"/usr/bin/bash -c 'nohup $(readlink -e "$0") 2> /dev/null';disown;exit 0\""
'Terminal=false'
'Type=Application'
'StartupNotify=false'
'Keywords=Games'
'Version=1.0')
echo "${dotDesktop[@]}" > "${desktopFile}"
xdg-desktop-icon install "${desktopFile}" 2> /dev/null
if [[ -d ~/Desktop ]]; then
cp -n "${desktopFile}" ~/Desktop && chmod 755 ~/Desktop/"${desktopFile##*/}"
fi
rm "${desktopFile}"
exit 0
}
# Create the clipboard reading function for Sequence Storm
write_sequence_storm_reader() {
if -e ~/.SequenceStormReader ]]; then
@ -959,6 +994,7 @@ fi
declare -A command=(
[c]="Check your system for necessary components."
[C]="Clear the cache. All game installers will be deleted."
[D]="Create desktop shortcut. You can launch audiogame-manager from the desktop or applications menu."
[d]="Debug mode, wine will be much more verbose when games are launched with this flag."
[h]="This help screen."
[i]="Install games."
@ -979,6 +1015,7 @@ while getopts "${args}" i ; do
case "$i" in
c) checklist;;
C) clear_cache;;
D) desktop_launcher;;
d)
unset WINEDEBUG
game_launcher