create shortcut on desktop

How to Easily Create Desktop Shortcuts on Raspberry Pi OS?

If you are used to other systems where creating desktop shortcuts is a breeze, this process might be a mystery to you after switching to Raspberry Pi OS. Don’t worry it isn’t very complicated, just follow the steps I will share with you in this tutorial.

If an app shortcut is available in the main menu, it’s possible to create a shortcut on the desktop with a drag & drop. If it’s a custom application not in the main menu, the only way will be to create the shortcut file (.desktop) with a text editor.

The first solution is pretty intuitive, whereas the second is almost impossible to remember. I’ll show you both in this article, with a tip to make the second easier.

Create desktop shortcuts for apps in the main menu

Creating a desktop shortcut for programs available in the main menu is straightforward: a drag & drop of the icon to the desktop will create the shortcut for you.

Get My Commands Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

I don’t think this is available in older versions, so you might need to either upgrade (procedure here) or read the next section if it doesn’t work. But on Raspberry Pi OS Bullseye at least, you can follow this easy process:

  • If you haven’t already, start by installing the application you want to add on the desktop.
  • Open the main menu, and check if you can find the application somewhere.
  • If you find the application, just drag and drop the icon on the desktop.
    Left-click on the link in the main menu and move your mouse to your wallpaper.
  • You should see an icon like this added on the desktop:
  • You can rename the shortcut if you want.
    Hit “F2” and type the new name in the window that shows up.

That’s it! Not so complicated, isn’t it?
You can now launch the app by double-clicking on it.

Create desktop shortcuts for custom programs

This was the easy way. But, if you are here, it’s probably because you didn’t find a way for this process to work.
For example, if you installed a program that isn’t automatically added to the main menu, or even have to run a script or command in a terminal.
I will explain all of this now.

Add it in the main menu

I will take the example of PyCharm, a famous programming tool that ranked well in my best text editors here.
When you download it on the website, you get an archive file (.tar.gz).
There is a script to run to open the program after extracting the files, but it doesn’t automatically create a main menu entry (yes, there is a way, but that’s not the point today).

So, if you are in this situation (you have an app working but no desktop or main menu shortcut), here is what to do:

Get My Commands Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!
  • Open the main menu, and go to Preferences > Main Menu Editor.
  • This tool allows you to choose which shortcut you want in the main menu.
    Just use the checkbox to enable or disable anything.
  • But you can also add new items:
    • Pick a category (“Programming” in my example).
    • Click on “Next Item” on the right.
    • A window like this shows up:

      Fill the form with at least the name and the executable path (in the command field).
      You can click on the image icon on the left to use a custom icon.
    • In my example with PyCharm, it will be something like that:
    • Once done, click on “OK” twice to save the changes.
  • The shortcut should now be available in the main menu.

Create the desktop shortcut

From there, you can just follow the drag & drop method I previously shared. This will create the new desktop shortcut.
In fact, this is just an easy way to generate the file we’ll create manually in the last solution (without having to remember the file content).

Get My Commands Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Create shortcut for a script or command line

The PyCharm example

In the previous method, we have learned how to create a “.desktop” file on our Desktop to get a shortcut to open an application. Another option is to directly create this file.
Here is what it looks like:

[Desktop Entry]
Comment=Run PyCharm
Terminal=false
Name=Pycharm
Exec=/home/pi/Downloads/pycharm-community-2020.3.5/bin/pycharm.sh
Type=Application
Icon=/home/pi/Downloads/pycharm-community-2020.3.5/bin/pycharm.png

So, basically, you can take this example, change the parameters to fit the application you want to run, and it should work.

Create your script and shortcut

I’ll show you a complete example to illustrate this manual method.
Let’s say I want to have a shortcut on my desktop to run htop.
Here is how to do this:

  • Create a new file on your desktop, with a .desktop extension.
    You can do this with the GUI (Right-click > New file) or with nano:
    nano /home/desktop/myshortcut.desktop
  • Paste these lines in it:
    [Desktop Entry]
    Comment=Monitor Pi Usage
    Terminal=true
    Name=Htop
    Exec=htop
    Type=Application
    Icon=/usr/share/pixmaps/htop.png

That’s it, it should now work directly.
If you want to run a custom script or command, you might need to run it in a terminal, by editing the “Exec” value like this:
lxterminal -e <your_command>
For example:
Exec=lxterminal -e /home/pi/myscript.sh

Get My Commands Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

Desktop entry main options

Right before we finish, here’s a table with the most common keys you can use to create the perfect desktop shortcut:

KeyDescriptionValues
NameThe name of the shortcut.Ex: “My Shortcut”
CommentThe tooltip (doesn’t work on Desktop I think).Ex: “My App Description”
ExecProgram to execute.Ex: “/usr/bin/app” or command
IconThe path to the icon to use for the shortcut./path/to/icon.ext
TypeThe type of desktop entry (as listed previously).Application, Link or Directory
TerminalOnly for type “Application”. true or false
URLOnly for type “Link”.https//domain.com
PathOnly for type “Application”. If you need to run it in a specific folder.Ex: “/home/pi/myapp”
Desktop entries keys

Here is a link to the complete documentation if you need more details (it’s for GNOME, but it’s similar on any desktop environment).


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Similar Posts