3

I read about making desktop launchers here.

I have already successfully made some launchers for my little Python programs.

I have a program called Formreturn, for making and marking multiple choice forms. It is great, and nowadays free from github. (I paid $600 for it back then, but it was worth it for me.)

For some reason, after installing the latest version, the desktop icon does not install, I have to start it from bash:

pedro@pedro-512ssd:~/Formreturn$ ./formreturn.sh

The program starts OK.

I spoke to Roland Quast, the author, about this, but he did not have a good solution. He blamed changes in Ubuntu.

So I thought I could make my own launcher:

[Desktop Entry]  
Version=1.0   
Name=Formreturn   
Comment=Multi-choice marking programme   
Exec=/home/pedro/Formreturn/formreturn.sh  
Icon=/home/pedro/icons/formreturn.png   
Terminal=false   
Type=Application  
Categories=Utility;Application;

I also tried with:

Terminal=true

But it does not launch!! Maybe because it is a bash script??

Any ideas what is wrong??

If you look at the attached picture, you will see what I see when I right click the launcher FR1. It has an extra tab "Open with".

If I right click my other home-made launchers, the ones for my Python programs, I don't see that, they just have 2 tabs: "Basic" and "Permissions"

Maybe this is some security feature??right click the launcher then go to properties

EDIT: This is formreturn.sh

#!/bin/bash  

# (I commented this out with #) FRM_HOME=.    
FRM_HOME="/home/pedro/Formreturn/"
COMMAND_PATH=`echo ${0} | sed -e "s/\(.*\)\/.*$/\1/g"`
cd ${COMMAND_PATH}

if [ -z $JAVA_HOME ]; then
    JAVA_COMMAND=`which java`
    if [ "$?" = "1" ]; then
        echo "No executable java found. Please set JAVA_HOME variable."
        exit
    fi   
else
    JAVA_COMMAND=$JAVA_HOME/bin/java
fi
if [ ! -x $JAVA_COMMAND ]; then
    echo "$JAVA_COMMAND is not executable. Please check the permissions."
    exit
fi
$JAVA_COMMAND -jar -Xmx1024m $FRM_HOME/lib/formreturn.jar "$1"  
0

1 Answer 1

6
  • The program you are trying to run appears to be this FormReturn. If so, you likely need to edit formreturn.sh so that FRM_HOME points to the location of the script (likely /home/pedro/Formreturn – Note, no trailing slash).

    By default, it is set to . which won't work when the script is called from a launcher because the pwd may not be the same as the script location.

  • Try recreating the desktop file from scratch. There may be something small that isn't right in the one you have. Like a trailing space that doesn't show up on the web.

    Also, make sure the .desktop file has the correct extension. Otherwise, it may be treated as an unknown filetype or ordinary text file.

2
  • 2
    My fault: I did not have the ending .desktop!! Stupid!! Now it works!! Sorry to have bothered you!
    – Pedroski
    Sep 27, 2020 at 3:57
  • @Pedroski No problem. It happens. Glad it's working now. I'm going to clean up my comments since I think it's pretty much covered in my answer.
    – xiota
    Sep 27, 2020 at 3:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .