W6JHB
Posts: 60
Joined: Thu Jul 24, 2014 4:21 am
Location: Folsom, CA

How to make icon to launch an app?

Tue Mar 06, 2018 1:27 am

Hi - running Raspian on a Pi 3 and have a relatively newbie question. I have an app along with a folder containing several required files residing in another folder in my home directory. If I double click the app from within the File Manager, it works great. However, I don’t want to have to fire up File Manager just to run this program. I tried copying the app to the desktop, but when I try to run it from the icon on the desktop, it doesn’t run. Apparently it has to be in the same location as the folder with those required files. Copying and pasting that folder to the desktop results in the app working when run from the desktop.

However, I don’t want to clutter up my desktop with folders up the wazoo every time one of those apps comes along. How can I create an icon, a Script, or whatever it takes to be able to click on ONE thing on the desktop that will execute the app in the folder in my home directory where it sits?

Tnx, Jim
Jim Bennett / W6JHB
Folsom, CA
USA

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand

Re: How to make icon to launch an app?

Tue Mar 06, 2018 2:00 am

these ICONs are .desktop files
nano /home/pi/Desktop/myprog.desktop

you can start a bash script or app

Code: Select all

[Desktop Entry]
Type=Application
Name=speed test start
Exec=/home/pi/projects/speedtestnet/speedtest.sh
Icon=network
Comment=start python speedtest-cli
Terminal=true
X-KeepTerminal=false
Categories=Network;
or a URL
nano /home/pi/Desktop/gmail.desktop

Code: Select all

[Desktop Entry]
Type=Link
URL=https://mail.google.com/mail/?tab=wm#inbox
Name=GMAIL
Icon=leafpad.png
Comment=start browser gmail

klricks
Posts: 8431
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: How to make icon to launch an app?

Tue Mar 06, 2018 2:33 am

Another way...

[Menu] -> [Preferences] -> [Main Menu Editor]
Select the menu that you want and click [New Item]
Fill in fields
If needed select Launch in terminal.
[OK] to exit editor

Now go [Menu] and find the new menu item and RIGHT click on it, then click [Add to Desktop]

Now if you want to make changes such as changing the icon file, the new desktop entry can be found here:

Code: Select all

~/.local/share/applications/alacarte-made.desktop
If you make a second or more desktop icon the it will look like this:

Code: Select all

~/.local/share/applications/alacarte-made-1.desktop
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

W6JHB
Posts: 60
Joined: Thu Jul 24, 2014 4:21 am
Location: Folsom, CA

Re: How to make icon to launch an app?

Tue Mar 06, 2018 9:28 pm

Thanks folks - I got it to work using a combination of the answers above. Much appreciated!
Jim Bennett / W6JHB
Folsom, CA
USA

Techster14
Posts: 10
Joined: Wed Aug 28, 2019 11:00 am

Re: How to make icon to launch an app?

Wed Sep 04, 2019 2:46 am

so, i tried the first responce and i get an error:

Code: Select all

Invalid desktop entry file: '/home/pi/Desktop/myprogram.desktop'
Why is it saying this?

Return to “Beginners”