2

is there a (FreeDesktop) Linux command to open an "open-with" dialog similar to xdg-open?

I'm searching for some general desktop environment independent solution for showing something like this:

Dolphin's open-with dialog

Of course there is xdg-open to open the file with the default app, but how do I give users a choice to open a file in a different app?

I'm also not looking for mimeopen that changes the current default application.

1

mimeopen is what you're looking for. Specifically mimeopen's -a or --ask option.

From the man page:

   -a, --ask
       Do not execute the default application but ask which
       application to run.  This does not change the default
       application.

Otherwise, it depends on your desktop environment and/or file browser. For example, xfce's Thunar file browser has an `Open With" option when you right-click on a filename, which displays a menu with all apps known to be capable of opening the file's filetype. The final menu item is "Open with Other Application" (which optionally lets you change the default).

  • Executing something like xterm -e "mimeopen -a myfile.txt" from an end-user GUI application looks really ugly :(. Regarding Thunar, I've attached a screenshot of the open-with dialog from dolphin, but I couldn't find a desktop-environment agnostic way to show this dialog. – Sebastian Wagner Mar 11 '16 at 9:48
  • that's because the dialog is specific to dolphin. As i said, it depends on your desktop environment and your file browser because it is those programs that implement the feature (or not), and each does it differently. – cas Mar 11 '16 at 16:02

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.