Running a.desktop documents in the incurable

From what I can collect, .desktop documents are shortcuts that permit application is setups to be tailored. As an example, I have great deals of them in my /usr/share/applications/ folder.

If I open that folder in nautilus, I can run these applications simply by double clicking its linked documents, as an example double - hitting firefox.desktop runs Firefox. Nonetheless, I can not locate a means to do the very same point using incurable.

If I do gnome-open foo.desktop it merely opens up foo.desktop as a message documents. If I make it executable and afterwards run it in celebration it merely falls short (which is anticipated, it is plainly not slam manuscript).
EDIT : Doing exec /fullpath/foo.desktop offers me a Permission denied message, also if I change hands to myself. If I make executable and also do the very same command, the incurable tab I'm making use of merely shuts (I'm presuming it collisions). Ultimately, if I do sudo exec /fullpath/foo.desktop, I get a mistake reporting sudo: exec: command not found.

That is my inquiry, just how can I run a foo.desktop documents from the terminal?

0
2019-05-13 04:39:55
Source Share
Answers: 2

The solution need to be

xdg-open program_name.desktop

But as a result of a bug this no more jobs.

0
2019-05-17 18:11:57
Source

The command that is run is had inside the desktop computer documents, come before by Exec= so you can extract and also run that by:

`grep '^Exec' filename.desktop | tail -1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` &

To damage that down

grep  '^Exec' filename.desktop    - finds the line which starts with Exec
| tail -1                         - only use the last line, in case there are multiple
| sed 's/^Exec=//'                - removes the Exec from the start of the line
| sed 's/%.//'                    - removes any arguments - %u, %f etc
| sed 's/^"//g' | sed 's/" *$//g' - removes " around command (if present)
`...`                             - means run the result of the command run here
&                                 - at the end means run it in the background

You can place this in a documents, claim ~/bin/deskopen with the materials

#!/bin/sh
`grep '^Exec' $1 | tail -1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` &

Then make it executable

chmod +x ~/bin/deskopen

And after that you can do, eg

deskopen /usr/share/applications/ubuntu-about.desktop

The debates (%u, %F etc) are described at http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html#exec-variables - none matter for going for the command line.

0
2019-05-17 16:57:53
Source