I tried to use xdg-open but it does not wait until the application terminates.

I also tried to get the MIME-type of the file with xdg-mime query filetype fileHere and using xdg-mime query default MIME-type-here. If I use these two commands on a txt file for example, I get "org.gnome.gedit.desktop". I do not know however how I can start and wait for the application using this string.

1 Answer 1


Old Answer:

I was able to determine the correct binary and call it directly by using the following steps:

  1. Get the MIME-type with xdg-mime query filetype fileHere -> e.g. text/plain
  2. Get the default app with xdg-mime query default mimeHere -> e.g. org.gnome.gedit.desktop
  3. Lookup the Exec= line in the app.desktop file under /usr/share/applications -> e.g Exec=gedit --new-document
  4. Call the correct binary and wait for it terminate -> e.g. gedit

New Answer:

You can use mimeopen.

You must log in to answer this question.

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