need help installing icon

icewaffle

New Member
Joined
Apr 19, 2020
Messages
2
Reaction score
0
Credits
0
hello,

Im fairly new to the linux I installed a program and I cant seem to get the icon on my desktop. I can only run it from the command line. How do I get it on my panel so I dont have to run it from the command line anymore?

Thanks in advance
 


Perhaps it is a 'command line' only program.
What is the program?
What Linux distribution did you install it on?
What 'desktop' are you using?
 
hello,

Im fairly new to the linux I installed a program and I cant seem to get the icon on my desktop. I can only run it from the command line. How do I get it on my panel so I dont have to run it from the command line anymore?

Thanks in advance

If this is a program that you have installed and it has an icon that appears somewhere in your systems main application menu and you want to have a shortcut/launcher for it on your desktop....
e.g.
something like vlc media player, or some-other common application that appears in the applications menu.

If this is the case - it's a simple case of:
1. Locate the .desktop launcher file:
e.g.
Code:
locate programname.desktop
Where programname is the name of the program we want to be able to launch from the desktop.

2. Create a soft-symbolic link to the launcher in your Desktop directory (or wherever else you want it!)
Code:
ln -sT /path/to/programname.desktop  ~/Desktop/programname
Simple!!

So, as an example - if we wanted a launcher icon for vlc in our Desktop directory, we would:
1. Locate the vlc.desktop file used by the menus:
Code:
locate vlc.desktop

Which, on my laptop - yields the path:
/usr/share/applications/vlc.desktop

NOTE: /usr/share/applications is the usual, expected location for .desktop files, but there are one or two other places where they might be found. So it's best to try to locate the launcher you're looking for using a command like locate or find.

Now we have the path to vlc.desktop - the next and final step is to
2. Create a symbolic link in our Desktop directory using the ln command:
e.g.
Step 2:
Code:
ln -sT /usr/share/applications/vlc.desktop ~/Desktop/vlc

Once that is done - we should be able to launch vlc using the icon in our Desktop directory. If we are using a desktop environment, or window manager that uses a traditional "Desktop" view - where the files in our Desktop directory appear as icons on the visual desktop - then an icon will be there. But be aware that some environments don't use the traditional desktop view.

And again, if you want a link to programX or programY - then substitute vlc in the above example for programX or programY.

So, once again - to sum up everything we've done so far.
Code:
locate programname.desktop
ln -sT /path/to/programname.desktop ~/Desktop/programname

Dead simple!

What if I am unable to find a .desktop file?
If you couldn't find a .desktop file for the application you're searching for - you can simply create one yourself.

The .desktop format is a simple text-based file-format. You fill out some simple information about the application (name, tooltip,path to the executable, icon to use etc.etc. ).
When the .desktop file is clicked/opened on the desktop, or in a menu - your desktop/window manager will launch the application.

Here is a link to a thread where I talk about creating a .desktop file to launch a terminal-based application here:

That post is primarily about manually installing your own scripts/programs in linux. But the last half of it discusses creating a .desktop file.

The fields in the example .desktop file in that thread are pretty self-explanatory - Change all of the fields to match the program you've installed.

The example .desktop I used in that particular post was for a terminal-based program.So if the program you're launching is a GUI program, then set the Terminal= field to false. If it is a terminal based program,that should be ran in a terminal emulator, so that users can interact with it, or see it's output - then leave it set to true.
If it is a terminal based program that should run silently in the background and you just want to use the .desktop file to launch the program - then set the Terminal= field to false.

Either way, create a .desktop file that can be used to launch your program. The thread in the link has a simple, example .desktop file.
It also has some links to freedesktop.orgs specification for .desktop files - which you can refer to. Also, take a look at the .desktop files for any similar programs that you might have installed on your machine. It may give you some ideas what to put into your custom launcher.

As another example - I use cmus - a terminal based audio player on all of my Debian systems at home. On our family PC, which my kids use - I have set up cmus with a shared library of music. So all users can access the same music.
However, cmus doesn't appear anywhere in the graphical menu. And my kids don't know how to use the terminal (and sadly, don't have any interest in learning about it either), but they do know how to use cmus.

So to allow them to run cmus on the family PC - I added a custom .desktop file to /usr/share/applications/ (to make it available to all users via the systems graphical menu) and put a symbolic link to it in all of their Desktop directories.

Here is the cmus.desktop file I created:
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=cmus
GenericName=cmus music player
Comment="lightweight terminal-based music player"
Type=Application
Icon=utilities-terminal
Categories=AudioVideo;Audio;
Exec=/usr/local/bin/cmus
Terminal=true

They can recognise it easily in the music applications menu because it has the boring, black, utilities-terminal icon! Ha ha ha!

Anyway - if you want your home-made .desktop launcher to appear in the system menus for all users, then copy the .desktop file to /usr/share/applications (as root). This is the option I chose with cmus.desktop
e.g.
sudo cp myprogram.desktop /usr/share/applications/
where myprogram.desktop is the name of your desktop file. So for me it would have been cmus.desktop.

OR:
If you want it to appear in the menu only for you and NOT other users - then copy the .desktop file to ~/.local/share/applications/
e.g.
cp myprogram.desktop ~/.local/share/applications/
Again - where myprogram.desktop is the name of your home-made .desktop file.

And that's how you can add custom launchers to the main menu.
So if you've written your own program, or script - you can launch it using a .desktop file.

And if you want to put the launcher you created on your desktop - ou can simply either:
1. Copy the .desktop file you created to your Desktop directory,
or:
2. Create a soft sym-link to the .desktop file you put in /usr/share/applications (or ~/.local/share/applications/) via the ln command (which we've already seen used in the first half of my post above!).

Creating a customised .desktop launcher isn't difficult and will allow you to add custom items to your system menu, or to launch applications graphically from your Desktop directory (or wherever else you want).

One other thing - If your program is a terminal based one - When launching from the GUI - you may also have problems with the window popping up briefly and then suddenly disappearing when it has finished.
If you do have problems with that, I mention a solution in the discussion thread in the link I posted earlier!
 
Last edited:
Perhaps it is a 'command line' only program.
What is the program?
What Linux distribution did you install it on?
What 'desktop' are you using?
electru
If this is a program that you have installed and it has an icon that appears somewhere in your systems main application menu and you want to have a shortcut/launcher for it on your desktop....
e.g.
something like vlc media player, or some-other common application that appears in the applications menu.

If this is the case - it's a simple case of:
1. Locate the .desktop launcher file:
e.g.
Code:
locate programname.desktop
Where programname is the name of the program we want to be able to launch from the desktop.

2. Create a soft-symbolic link to the launcher in your Desktop directory (or wherever else you want it!)
Code:
ln -sT /path/to/programname.desktop  ~/Desktop/programname
Simple!!

So, as an example - if we wanted a launcher icon for vlc in our Desktop directory, we would:
1. Locate the vlc.desktop file used by the menus:
Code:
locate vlc.desktop

Which, on my laptop - yields the path:
/usr/share/applications/vlc.desktop

NOTE: /usr/share/applications is the usual, expected location for .desktop files, but there are one or two other places where they might be found. So it's best to try to locate the launcher you're looking for using a command like locate or find.

Now we have the path to vlc.desktop - the next and final step is to
2. Create a symbolic link in our Desktop directory using the ln command:
e.g.
Step 2:
Code:
ln -sT /usr/share/applications/vlc.desktop ~/Desktop/vlc

Once that is done - we should be able to launch vlc using the icon in our Desktop directory. If we are using a desktop environment, or window manager that uses a traditional "Desktop" view - where the files in our Desktop directory appear as icons on the visual desktop - then an icon will be there. But be aware that some environments don't use the traditional desktop view.

And again, if you want a link to programX or programY - then substitute vlc in the above example for programX or programY.

So, once again - to sum up everything we've done so far.
Code:
locate programname.desktop
ln -sT /path/to/programname.desktop ~/Desktop/programname

Dead simple!

What if I am unable to find a .desktop file?
If you couldn't find a .desktop file for the application you're searching for - you can simply create one yourself.

The .desktop format is a simple text-based file-format. You fill out some simple information about the application (name, tooltip,path to the executable, icon to use etc.etc. ).
When the .desktop file is clicked/opened on the desktop, or in a menu - your desktop/window manager will launch the application.

Here is a link to a thread where I talk about creating a .desktop file to launch a terminal-based application here:

That post is primarily about manually installing your own scripts/programs in linux. But the last half of it discusses creating a .desktop file.

The fields in the example .desktop file in that thread are pretty self-explanatory - Change all of the fields to match the program you've installed.

The example .desktop I used in that particular post was for a terminal-based program.So if the program you're launching is a GUI program, then set the Terminal= field to false. If it is a terminal based program,that should be ran in a terminal emulator, so that users can interact with it, or see it's output - then leave it set to true.
If it is a terminal based program that should run silently in the background and you just want to use the .desktop file to launch the program - then set the Terminal= field to false.

Either way, create a .desktop file that can be used to launch your program. The thread in the link has a simple, example .desktop file.
It also has some links to freedesktop.orgs specification for .desktop files - which you can refer to. Also, take a look at the .desktop files for any similar programs that you might have installed on your machine. It may give you some ideas what to put into your custom launcher.

As another example - I use cmus - a terminal based audio player on all of my Debian systems at home. On our family PC, which my kids use - I have set up cmus with a shared library of music. So all users can access the same music.
However, cmus doesn't appear anywhere in the graphical menu. And my kids don't know how to use the terminal (and sadly, don't have any interest in learning about it either), but they do know how to use cmus.

So to allow them to run cmus on the family PC - I added a custom .desktop file to /usr/share/applications/ (to make it available to all users via the systems graphical menu) and put a symbolic link to it in all of their Desktop directories.

Here is the cmus.desktop file I created:
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=cmus
GenericName=cmus music player
Comment="lightweight terminal-based music player"
Type=Application
Icon=utilities-terminal
Categories=AudioVideo;Audio;
Exec=/usr/local/bin/cmus
Terminal=true

They can recognise it easily in the music applications menu because it has the boring, black, utilities-terminal icon! Ha ha ha!

Anyway - if you want your home-made .desktop launcher to appear in the system menus for all users, then copy the .desktop file to /usr/share/applications (as root). This is the option I chose with cmus.desktop
e.g.
sudo cp myprogram.desktop /usr/share/applications/
where myprogram.desktop is the name of your desktop file. So for me it would have been cmus.desktop.

OR:
If you want it to appear in the menu only for you and NOT other users - then copy the .desktop file to ~/.local/share/applications/
e.g.
cp myprogram.desktop ~/.local/share/applications/
Again - where myprogram.desktop is the name of your home-made .desktop file.

And that's how you can add custom launchers to the main menu.
So if you've written your own program, or script - you can launch it using a .desktop file.

And if you want to put the launcher you created on your desktop - ou can simply either:
1. Copy the .desktop file you created to your Desktop directory,
or:
2. Create a soft sym-link to the .desktop file you put in /usr/share/applications (or ~/.local/share/applications/) via the ln command (which we've already seen used in the first half of my post above!).

Creating a customised .desktop launcher isn't difficult and will allow you to add custom items to your system menu, or to launch applications graphically from your Desktop directory (or wherever else you want).

One other thing - If your program is a terminal based one - When launching from the GUI - you may also have problems with the window popping up briefly and then suddenly disappearing when it has finished.
If you do have problems with that, I mention a solution in the discussion thread in the link I posted earlier!
thank you this really helped :)
 


Top