I just figured out how to manually create a .desktop file which allows a program to be launched by issuing the command gtk-launch [program.desktop]. Problem is it only seems to work if my present working directory is the Desktop directory for my username. Thus when I enter the command gtk-launch program.desktop it runs.

The problem is when I try to enter gtk-launch /home/userName/Desktop/program.desktop. Instead I get a message from terminal saying: gtk-launch: no such application. I know the file is there and cat works just fine reading it.

Why does gtk-launch only seem to be working from inside Desktop? Can I get around this? I'm using Kali linux with GNOME from a persistent USB.

  • Did you find any of what was posted useful? It is always good to provide feedback. Commented Dec 22, 2021 at 21:48
  • To clarify for future visitors, this was an XY problem, where X was "use gtk-launch to launch a program" and Y was "get gtk-launch to understand absolute filesystem paths" —which, as noted below, it doesn't. I can totally relate to this, because my X and Y were the same. ;)
    – Kevin E
    Commented Dec 26, 2022 at 20:42

3 Answers 3


To make this work, you have to satisfy two requirements:

  1. Your myapp.desktop file should reside in one of several directories (not exclusively /usr/share/application). These depend on your Linux distro; for Ubuntu:

    1.1. /usr/share/application

    1.2. /usr/local/share/applications

    1.3. ~/.local/share/applications

  2. You have to execute gtk-launch myapp (or gtk-launch myapp.desktop) without the path.





The manpage states the following:

gtk-launch takes at least one argument, the name of the application to launch. The name should match application desktop file name, as residing in /usr/share/application, with or without the '.desktop' suffix.

This indicates that the desktop file should be in the specified location, otherwise it can't used to launch an application. Source file gtk/gtk-launch.c shows that gtk-launch doesn't execute anything, but puts a message on D-Bus to to ask for the launch the required application.

  • Ah yes. It does. Although it does beg the question--how does one launch a program via a .desktop file with the command line from OUTSIDE of the desktop? I haven't come across any solution which does not involve gtk-launch. Commented Sep 19, 2017 at 1:05
  • For that this post on AskUbuntu may set you on your way.
    – hspaans
    Commented Sep 20, 2017 at 6:31

Another possibility is that the desktop entry file being invalid. Try desktop-file-validate /home/userName/Desktop/program.desktop to see if it is and fix problems. In my case this works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .