Added flag to create a .desktop file so audiogame-manager can be launched from the desktop or applications menu.
This commit is contained in:
parent
772634750c
commit
55f15b234c
@ -113,6 +113,41 @@ open_url() {
|
|||||||
fi
|
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
|
# Create the clipboard reading function for Sequence Storm
|
||||||
write_sequence_storm_reader() {
|
write_sequence_storm_reader() {
|
||||||
if -e ~/.SequenceStormReader ]]; then
|
if -e ~/.SequenceStormReader ]]; then
|
||||||
@ -959,6 +994,7 @@ fi
|
|||||||
declare -A command=(
|
declare -A command=(
|
||||||
[c]="Check your system for necessary components."
|
[c]="Check your system for necessary components."
|
||||||
[C]="Clear the cache. All game installers will be deleted."
|
[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."
|
[d]="Debug mode, wine will be much more verbose when games are launched with this flag."
|
||||||
[h]="This help screen."
|
[h]="This help screen."
|
||||||
[i]="Install games."
|
[i]="Install games."
|
||||||
@ -979,6 +1015,7 @@ while getopts "${args}" i ; do
|
|||||||
case "$i" in
|
case "$i" in
|
||||||
c) checklist;;
|
c) checklist;;
|
||||||
C) clear_cache;;
|
C) clear_cache;;
|
||||||
|
D) desktop_launcher;;
|
||||||
d)
|
d)
|
||||||
unset WINEDEBUG
|
unset WINEDEBUG
|
||||||
game_launcher
|
game_launcher
|
||||||
|
Loading…
Reference in New Issue
Block a user