Create Desktop Panel Launchers via terminal (Shell Scripts)


I'm writing an installation shell script and part of the installation procedure is to setup a few desktop panel launchers for the users.

Is this possible to script?

The manual steps I currently do are ..
Right Click Panel -> Add to Panel -> Create Application Launcher ->
Type : Application In Terminal
Name: Application1
Command: /Path/Application1

I usually then click on the icon and set a specific icon.

I can find plenty of examples for manual steps but nothing via the command line
Who is Participating?
nociConnect With a Mentor Software EngineerCommented:
You should not need keystroke sequences.
It suffices to create whatever.desktop files in the right directories.
In the text file is a list of names of the item in various languages. and what command to perform...
Those directories may  vary from distro to distro.. and display manager to display manager:

find / -name '*.desktop'
whill show you where they are...

.desktop entry  for chromium:  ~/.local/share/plasma_icons/chromium-browser-chromium.desktop  (in my personal directory, for kde 5/Plasma).

[Desktop Entry]
Comment=Open-source version of Google Chrome web browser
Exec=chromium-browser %U

Open in new window

The "Exec=" line is the command to be executed, here the chromium browser  with a parameter.
Other entries suggest with filtypes (determined by mime-type) this .desktop  is suggested for.
Name, Icon to be shown etc.
Extra Name & Comment entries might also be:
Duncan RoeSoftware DeveloperCommented:
It may well be possible to do what you want. You will need to find the control files(s) used to generate the launcher. Usually under LInux these are text files so potentially editable by a script. (Under Windows, they are almost always binary). Googling may find them, otherwise you will need to find them yourself: that involves making a change via the GUI then searching for recently modified files. You may need to close the GUI before they are written.
You don't mention what is your desktop so that's about all I can give you right now. Post back if you'd like help finding recently modified files.
PJ0302917Author Commented:
Thanks, il give it a test now
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.