Author Topic: xdg-open (termux)  (Read 3123 times)

Pete G.

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • http://www.GoodeveCA.net
xdg-open (termux)
« on: June 20, 2018, 09:23:06 pm »
I've been trying to find a way to communicate between termux work and android apps, and eventually stumbled across xdg-open, which in Linux "opens a file or URL in the user's preferred application".  I have a test html file in my termux area that I'd like to open in Firefox -- which I've set as my default.  However if I invoke xdg-open on it, it only gives me a choice of Chrome, plus some other irrelevant options.  Anyone know what's going on here -- and how to get what I want?

vader

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
xdg-open (termux)
« Reply #1 on: June 20, 2018, 11:13:05 pm »
Quote from: Pete G.
I've been trying to find a way to communicate between termux work and android apps, and eventually stumbled across xdg-open, which in Linux "opens a file or URL in the user's preferred application".  I have a test html file in my termux area that I'd like to open in Firefox -- which I've set as my default.  However if I invoke xdg-open on it, it only gives me a choice of Chrome, plus some other irrelevant options.  Anyone know what's going on here -- and how to get what I want?

As a matter of interest, why don't you use termux-open or termux-open-url. I think you have to install termux utils to get these. You can specify content-type as an argument if you want to override the defaults. Choose a type which firefox supports (I would have thought html would do it) and it starts the android app and opens the file.

Pete G.

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
    • http://www.GoodeveCA.net
xdg-open (termux)
« Reply #2 on: June 21, 2018, 02:20:04 am »
Quote from: vader
As a matter of interest, why don't you use termux-open or termux-open-url. I think you have to install termux utils to get these. You can specify content-type as an argument if you want to override the defaults. Choose a type which firefox supports (I would have thought html would do it) and it starts the android app and opens the file.

It turns  out that xdg-open _is_ termux-open! {a link)  And this is just a script that uses 'am' to call a common handler that termux provides.  It must in there somewhere that it's deciding that Firefox isn't eligible.  I'm getting a crash indoctrination into am and intents, though, so maybe I can figure it all out!

[I still can't figure out how  to add italics and emoticons from the Gemini, though]