0

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.

1

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. – Shadow43375 Sep 19 '17 at 1:05
  • For that this post on AskUbuntu may set you on your way. – hspaans Sep 20 '17 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.