Pandora A working line in bash to call the browser on Pandora ?


ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
Just a simple request : what would be the best way to call the browser on the Pandora to open a web page, from inside an application ?


I think a bash-line could do that, but what do you recommend ?


(And I would also like to know if there is a way to confirm if Firefox or some other browser is installed, to call a specific one of them).
 
While that should be



Code:
xdg-open <url>

it somehow does not seem to work :/



Well, I guess you'll always have



Code:
links <url>

available…
 
I think you would first need to create a script that starts up a web browser on a particular page, and then call that script from inside your application. How complicated your script needs to be depends on the PND's start-up script - namely whether it's been setup to recognise command-line arguments or not, e.g. if it runs "bin/chromium $*", or just calls "bin/chromium". If it's the latter, you'll need to over-ride the PND's start-up script - a good example of how to do this is Lomaxx's script here:


Probably the quickest way to find out which browsers are installed (rather than scanning SD cards for PNDs), is to look for .desktop files in /usr/share/applications and ~/Desktop.
 
It's not the first time I make this proposal, but I'll make it again:


Instead of just creating the menu entries and desktop icons when PNDs are detected, we could also create symlinks or small scripts in /usr/bin (or some other directory that would be in PATH by default, e.g. /usr/pandora/bin). All we need is an additional entry in the PXML file to give a name to each application, and of course you have to make sure that the runscripts nicely pass along all command line parameters. So you would have /usr/bin/firefox which would start the firefox PND, etc. For command line people this would be much more convenient than the current situation.
 
It should be possible. It would need an amendment to the PXML spec for essentially a list of commands provided by the pnd (with command name and what to call inside the pnd to do the command). I would also recommend we make the runscripts be on a tmpfs directory we add to the path, so that they will cause no NAND wear (for those who are worried), and can also be nicely (and automatically on reboot :) ) cleaned up. There is the little semi-issue that mounting a pnd is quite a heavy operation, so if somebody adds some small often-used command, the experience will either be quite slow each time it is called, or we need some pnd-mount-caching system to the daemon - that would need some intelligence since the loopback mounts are a limited resource.
 
Instead of creating a new thread I ask here.

I'm working on script that should open a local URL in XFCE default browser.

In my XFCE Preferred Applications > Web browser I have set:


pnd_run '/media/ATMAN/pandora/menu/firefox-20.0-0.pnd "%s"'

Script snippet that calls the browser looks like this:


function opengui(){
#Read the current IP address
export IP=$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
export LINK=$IP:8888/gui
exo-open --launch WebBrowser $LINK
}

And CLI output looks like this:


Runscript /usr/pandora/scripts/pnd_run.sh
Pndfile /media/ATMAN/pandora/menu/firefox-20.0-0.pnd "192.168.2.101:8888/gui"
Subapp Number 0

exo-open takes over the XFCE preferred web browser setting correctly (it launches pnd_run with pnd path argument including the URL) but nothing happens after that point. Firefox doesn't start.

I'm sure my custom preferred browser setting is not somehow correct because the page was loaded fine when I switched it to pre-installed Lynx which has it's default option in that setting. Unfortunately Lynx makes targeted page useless.

Thanks in advance for any suggestions.
 
Little progress but no results so far.

I've corrected the preferred browser setting to right syntax:


'pnd_run '/media/ATMAN/pandora/menu/firefox-20.0-0.pnd' "%s"

Issue was in the single quotes. They should be around pnd_run and path only.

But still it seems that exo-open is not able to pass the URL argument correctly that PND's are not able to handle arguments correctly.

Further digging proves that.

I get this error message:

Failed to execute default Web Browser.
Failed to execute child process "pnd_run /media/ATMAN/pandora/menu/firefox-20.0-0.pnd" (No such file or directory).
 
Last edited by a moderator:
Perhaps a file-association could help with some trickery there.

I'm not on top of the xfce settings etc, but if it has problems parsing the args properly then you coudl wrpa it up in a script (so that it becomes a single executable, which in turn calls pndrun and the executable.)

Now all that aside, note there are two pnd_run's .. theres pnd_run the binary ("pnd_run"), which can run an app just fine; it'll find pnd_run.sh and set up the call for you, but it has some limits; its mostly for quick and dirty invocations. If you want more power over the run, use pnd_run.sh directly; a few more things need to be specified (such as the appdata name and such), but it gives you more flexibility, and has some good argument handling; note the '--' option which allows anything after the -- to be passed more literally to the pnd without being expanded by the pnd_run.sh handled; we needed it for properly handling arguments in the file-association thing.

Amnyway, I haven't thought at all, got 3 babies climbing me now, and give you 10secs only.. but you have multiple small challenges here.. i) figure out what xfce is doing when launching, and then ii) figure out how to invoke the pnd; you can do these separately. Get the pnd invocationw ith arguments working from the shell, so you know what to do; then get the xfce launchign bit going, calling the pndf as needed.

Sorry, gotta run .. I took a day off to watch babies so my wife could have a day of freedome; so I'm buried :)

jeff
 
Back
Top