Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
open_with_script.sh
#!/bin/bash
echo -n "Enter Application name:"
read Name
if [ "$Name" = "" ]
then
echo "ERROR: Application name can't be empty"
exit 1
fi
echo -n "Comment about Application:"
read Comment
echo -n "Exec (eg: java -jar /home/alse/somescript.jar %U):"
read Exec
echo -n "MimeType (eg:application/xml):"
read Mimetype
if [ "$Exec" = "" ]
then
echo "ERROR: Exec can't be empty"
exit 1
fi
echo "
[Desktop Entry]
Name=$Name
GenericName=$Name
Comment=$Comment
Exec=$Exec
Terminal=false
Type=Application
StartupNotify=true
MimeType=$MimeType
Categories=GNOME;GTK;Utility;
X-GNOME-FullName=$Name
Actions=Window;Document;
X-Ubuntu-Gettext-Domain=$Name
[Desktop Action Window]
Name=Open a New Window
Exec=$Exec
OnlyShowIn=Unity;
[Desktop Action Document]
Name=Open a New Document
Exec=$Exec
OnlyShowIn=Unity;">~/.local/share/applications/$Name.desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment