How to Create a desktop luncher in Rocky Linux 9

Hello, I need help.

I know it’s a simple thing but I still can’t figure it out.

I have compiled a 3D design program called “Armorpaint”.

I managed to get it right and the program runs. My problem is that for it to run I have to enter the terminal and run this command:

cd /home/username/armorpaint/armorcore/Deployment && ./ArmorPaint …/…/…/build/krom

I have created a text file and given it permissions to run as a program, however I always have to right click and tell it to run as a program for it to run properly.

What I want is to make a launcher so I can put it in my dock and from there open the program normally. I tried to use “free menu” but for some reason it doesn’t work well, I tried to use other programs to create launchers but they don’t seem to accept the command line I put for this purpose.

If someone could help me with this task I would appreciate it very much.

Hi,

You can probably do similar to what I did when making my own package for the pyCharm app from the tar file that they had. You can create a launcher in /usr/local/share/applications with content similar to below:

# cat jetbrains-pycharm-ce.desktop

[Desktop Entry]
Version=1.0
Type=Application
Name=PyCharm Community Edition
Icon=/opt/pycharm/bin/pycharm.svg
Exec="/opt/pycharm/bin/pycharm.sh" %f
Comment=Python IDE for Professional Developers
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-pycharm-ce

Change the icon and exec fields, so maybe it would look something like this:

[Desktop Entry]
Version=1.0
Type=Application
Name=ArmorPaint
Icon=/opt/pycharm/bin/pycharm.svg
Exec="/home/username/armorpaint/armorcore/Deployment /path/to/build/krom" %f
Comment=ArmorPaint 3D Design App
Categories=Development;
Terminal=false
StartupWMClass=armorpaint

and save it in the directory I mentioned as armorpaint.desktop. To refresh your menu, run:

gtk-update-icon-cache

you may also need to log out. If providing the path like I did in EXEC doesn’t work, then put your script here which you tried to run before with the cd command in, etc. Running it the way I did, means you need to put the full path to the krom directory. The %f should allow you to open files created with that app, unless krom is the file you are opening to edit. In which case remove the %f.

1 Like

thanks a lot for you help.

I made my .deskto file and everything. i place it on the folders you mentioned and in other where ialso found .desktop files of others app ihave installed, then i run gtk-update-icon-cache but it didn´t work. i can not find my icon, so i can not run it, so i don´t know if it is working or not.

Hi,

Did you try logging out and logging back in?

If that doesn’t work, can you please provide the contents of the .desktop file?

Regards Tom.

sure, i did it. the content is as @iwalker put it here. few variatons

[Desktop Entry]
Version=1.0
Type=Application
Name=ArmorPaint
Icon=/home/user/armorpaint/icon.png
Exec="/home/user/armorpaint/armorcore/Deployment && ./ArmorPaint …/…/…/build/krom" %f
Comment=ArmorPaint 3D Design App
Categories=Graphics;
Terminal=false
StartupWMClass=armorpaint

You have to replace the …/…/…/ as I told you in my post and put the full path. Also, if krom is a file you are opening you don’t need the %f as I also wrote.

Also I forgot, after deployment, you need to also put /Armorpaint. So your EXEC line will look like:

Exec="/home/username/armorpaint/armorcore/Deployment/ArmorPaint /path/to/build/krom" %f

Calling two commands like is probably a problem.

The argument to ArmorPaint is a relative path. You do know the absolute path too:

ArmorPaint /home/user/build/krom

With the absolute path it does not matter what the current working directory is; we can call ArmorPaint from anywhere.

The ./ in ./ArmorPaint, because the directory /home/user/armorpaint/armorcore/Deployment is not on the PATH.
The ./ArmorPaint is relative and in your case means /home/user/armorpaint/armorcore/Deployment/ArmorPaint.

/home/user/armorpaint/armorcore/Deployment/ArmorPaint /home/user/build/krom

is a single command and can be called from any location.
It will fail only if the ArmorPaint expects current working directory to be the directory, where the program is.

1 Like

One more thing …

The PATH should already contain entry ~/.local/bin. That is one of “standard locations”. In other words, if the executable would be in directory, /home/user/.local/bin/, then you could call it with plain filename: ArmorPaint.

(This too assumes that the program does not have supporting files that it seeks relative to its own location.)

ok so i fixe it like this.

But i still not seen my icon.

[Desktop Entry]
Version=1.0
Type=Application
Name=ArmorPaint
Icon=/home/unocastillo/armorpaint/icon.png
Exec="/home/user/armorpaint/armorcore/Deployment/ArmorPaint /home/user/armorpaint/build/krom" %f
Comment=ArmorPaint 3D Design App
Categories=Graphics;
Terminal=false
StartupWMClass=armorpaint

i did the fix. but i still not seen my icon anywhere. I trayed to use “appeditor” app but i doesn´t let me save. i guess the command line doesn´t like it.

I am not very good at these things, although I have made launchers in other linux distributions before, but for some reason this one is not working for me.

And well it’s the first time I compile an application.

What I find curious is that if I “run as a program” the text file I made with the command line I showed you in my first post, the app runs.

[Desktop Entry]
Version=1.0
Type=Application
Name=ArmorPaint
Icon=/home/unocastillo/armorpaint/icon.png
Exec="/home/user/armorpaint/armorcore/Deployment/ArmorPaint /home/user/armorpaint/build/krom" %f
Comment=ArmorPaint 3D Design App
Categories=Graphics;
Terminal=false
StartupWMClass=armorpaint

You have two commands in your initial attempt (deployment and krom) and only one in your last attempt and your commands don’t match.

yes because I have been changing it according to the comments here exposed.

That’s as may be, but your commands are doing different things, and since they are doing different things there’s no way that they will all work.

Exec=“/home/user/armorpaint/armorcore/Deployment && ./ArmorPaint …/…/…/build/krom”

This runs a program named Deployment and then runs a program named krom after that.

/home/user/armorpaint/armorcore/Deployment/ArmorPaint /home/user/armorpaint/build/krom

This runs a program named ArmorPaint and provides a commandline parameter to it that says “/home/user/armorpaint/build/krom”. You also have a %f at the end of that line whose function I’m not sure of.

In summary, your first commandline runs two programs, one right after the other. The second commandline runs one program only. So they don’t (and can’t) do the same thing.

i see. whichone should i use then? i am just using the command that i use in the terminal to run the app.

In the OP there was ‘cd’ to directory Deployment followed by run of ArmorPaint. The launcher forgot the cd …

ok, i made the fix, but i still not seen the icon anywhere.

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=ArmorPaint
Icon=/home/unocastillo/armorpaint/icon.png
Exec=“cd /home/unocastillo/armorpaint/armorcore/Deployment/ArmorPaint /home/unocastillo/armorpaint/build/krom” %f
Comment=ArmorPaint 3D Design App
Categories=Graphics;
Terminal=false
StartupWMClass=armorpaint