0

The xdg-open command opens a file specified with the default app associated with the type. Is there an alternative that would raise the system native application choice dialog (which pops up when you right-click a file and select "Open With...") instead?

1

1 Answer 1

0

xdg-open is designed to open files and web pages in the user's default application. I see no option to do otherwise.

The man-page shows:

Description

xdg-open opens a file or URL in the user's preferred application. If a URL is
provided the URL will be opened in the user's preferred web browser. If a file
is provided the file will be opened in the preferred application for files of
that type. xdg-open supports file, ftp, http and https URLs.

Alternative:

xdotool

Of course, you will have to amend the alias to match your settings to bring up that dialog box.

Also:

gnome-panel-control --run-dialog

If not installed install it, if it can be installed.

8
  • Any alternative? I don't insist to use xdg-open (I just couldn't imagine a better tag).
    – Ivan
    Commented Dec 6, 2018 at 3:41
  • 1
    Added Alternative... Commented Dec 6, 2018 at 3:49
  • 1
    I'm writing a PyQT app that, among other features, would let you open a particular file in an application you choose. I thought it could be nice to outsource this to the system but it seems I better just parse the system MIME/apps database and populate a list. Two of the goals of the app design are to require zero installation (just a single py file to copy around) and to be cross-platform, depending on an X11 keyboard/mouse input simulator doesn't really suit this.
    – Ivan
    Commented Dec 6, 2018 at 4:07
  • 1
    Could you take advantage of VISUAL vs EDITOR type environment variables, to leverage the options you present to the user? Commented Dec 6, 2018 at 4:15
  • 1
    I was just thinking you could make it so the script looks for what is available on the system (not every program but say from a pool of 5 or so known apps for each of the main file types your expected user-ship will be opening) it then creates its own menu to present and opens the file with the chosen application. Commented Dec 6, 2018 at 4:35

You must log in to answer this question.

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