Here is a utility script to automate building desktop files for your scripts.
Put this script in /root/ and make executable.
It needs an sh directory in /root. place scripts with .sh extension in there. Make an icon directory inside /root/sh/icons ... place icon, named same as script without .sh extension, in /root/sh/icons dir (and it must be a .png image).
Finally click on this script /root/script-2-desktop.sh
A yad --icons gui showing the self-executing desktop files will open. This is handy in case you don't want to add your scripts to the menu, but still want to have an easy visually identifiable file to execute your script with. These files are readily relocatable.
Code: Select all
#!/bin/bash
# by stemsee
[ ! -d /root/sh/icons ] && mkdir -p /root/sh/icons
[ ! -d /root/apps ] && mkdir -p /root/apps
# add script name here without .sh extension. one per line.
list=''
echo -e "$list" | grep -v -e '^$' | sed -e 's/ //g' -e 's/\n/ /g' | while read line
do
if [[ ! -z "$line" ]]; then
NAME="$line"
[[ ! -d /root/apps/"$NAME".desktop ]] && echo -e "[Desktop Entry]
Name=$line
Version=1.0
Comment=
Exec=/bin/bash -c \"eval exec /root/sh/$line.sh\"
Icon=/root/sh/icons/$NAME.png
StartupNotify=false
Terminal=false
Type=Application
" > /root/apps/"$NAME".desktop
fi
done
yad --title="script.desktop" --geometry=1116x182+316+43 --icons --read-dir=/root/apps --monitor --no-buttons --skip-tray &