Desktop-file maker for own scripts

If wanting to run own script via menu or app-select, there must be a desktop-file in /usr/share/applications or $HOME/.local/share/applications

A desktop-file can do by hand or via script.

desktopfile-builder2

Edit: 5.6.2023: Fields GenericName and Keywords added.

Edit: 6.6.2023: I made deb and rpm packages.

Edit: 22.4.2024 New packages

desktopfile-builder3-deb-and-rpm-packages.zip

########################################

#!/bin/bash
## RPJ 5.6.2023
#
NAME=`yad --center --width=500 --height=100 --text-align=center --text="PROGRAM NAME" --entry --entry-label=HERE --entry-text=""`
PROG=`cd /usr && yad --file --width=1000`
ICON=`cd /usr/share/icons && yad --file --width=1000`
COMMENT=`yad --center --width=500 --height=100 --text-align=center --text="COMMENT" --entry --entry-label=HERE --entry-text=""`
CATE=`yad --center --width=500 --height=100 --text-align=center --text="CATEGORIES" --entry --entry-label=HERE --entry-text=""`
MIME=`yad --center --width=500 --height=100 --text-align=center --text="MIMETYPE" --entry --entry-label=HERE --entry-text=""`
GEN=`yad --center --width=500 --height=100 --text-align=center --text="GENERIC NAME" --entry --entry-label=HERE --entry-text=""`
KW=`yad --center --width=500 --height=100 --text-align=center --text="KEYWORDS" --entry --entry-label=HERE --entry-text=""`
##
if [ $? = 0 ];
then
{
echo '#!/usr/bin/env xdg-open'
echo '[Desktop Entry]'
echo 'Version=1.0'
echo 'Type=Application'
echo 'Terminal=false'
echo "Icon=$ICON"
echo "Name=$NAME"
echo "TryExec=$PROG"
echo "Exec=$PROG"
echo "Comment=$COMMENT"
echo "Categories=$CATE;"
echo "MimeType=$MIME;"
echo "GenericName=$GEN;"
echo "Keywords=$KW;"
} > $HOME/$NAME.desktop
yad --center --width=500 --height=30 --text-align=center --text="New desktop file has made"
else exit 0
fi