0

My problem is pretty simple, but I must admit, I don't know any elegant solution. I have a problem, that I often accidentally click different icon that I wanted. It's really very unpleasant, so I've decided to write a bash script, which will ask me if I really want to launch the program ( especially Eclipse, because it's pretty large and so it takes lots of time to load ).

I had written it, then added its location to the eclipse.desktop file... And now there's my problem. The Eclipse launcher works, but if I launch only Terminal, Eclipse icon shows up instead of original Terminal's.

Do you know how could I solve this, if I wanted to keep my bash script working?


Here is my bash script eclipseLaunch.sh:

#!/bin/bash
echo "Do you really want to launch Eclipse? (yes = y)"

read answer

if [[ "$answer" = "y" ]]; then
    ~/.eclipse/eclipse
fi

And here is my eclipse.desktop file:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Eclipse
Exec=gnome-terminal -e "bash -c \"~/.eclipse/eclipseLaunch.sh; exec bash\""
Icon=/home/martin/.eclipse/icon.xpm
Terminal=false
2

Finally I've solved it. After this solution I had to restart PC.

I've changed my eclipse.desktop file to this:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Eclipse
Exec=bash -c "~/.eclipse/eclipseLaunch.sh; exec bash"
Icon=/home/martin/.eclipse/icon.xpm
Terminal=true

And eclipseLaunch.sh to this:

#!/bin/bash
echo "Do you really want to launch Eclipse? (yes = y)"

read answer

if [[ "$answer" = "y" ]]; then
    nohup ~/.eclipse/eclipse &
else
    kill $PPID
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.