package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dadde8cfa62be9dabd805fc190b415427b4699ffe3458c153e2f3f9cc5c9b9b4
md5=f96ac96fb0182f2b97dbe9ded452544b
doc/b0.care/B0_ui/Browser/index.html
Module B0_ui.Browser
Web browser interaction.
Browser
shows URIs in the user's browsers. Up to severe platform and browser application limitation it tries to limit the creation of new tabs, reloading existing one which have the same URI or are, if requested, prefixed by the URI.
Cli arguments
val browser : B0_std.Cmd.t option Cmdliner.Term.t
browser
is a --browser
option and BROWSER
environment variable to use with the browser
argument of find
.
val prefix : bool Cmdliner.Term.t
prefix
is --prefix
option to use the prefix
argument of show
.
val background : bool Cmdliner.Term.t
background
is a --background
option to use the background
argument of !show
.
Show URIs
val find :
?search:B0_std.Fpath.t list ->
browser:B0_std.Cmd.t option ->
unit ->
(t option, string) result
find ~search ~browser
tries to find a browser in a rather complex and platform dependent way.
show ~background ~prefix browser uri
shows URI using browser browser
(if None
an error message is returned mentioning that no browser was found. If background
is true
tries to keep the browser application in the background, if false
brings it in user focus.
The function tries to limit the creation of new tabs using the following strategy:
Repeat from the frontmost browser window to the backmost one until a tab to reload is found:
- If the window's current tab's URI is
uri
(or is prefixed byuri
whenprefix
istrue
), reload this tab. - If the window has one or more tab whose URI is
uri
(or is prefixed byuri
whenprefix
istrue
), pick the left most one, make it current in the window and reload it.
- If the window's current tab's URI is
- If no tab was found, get the frontmost window. If the current tab has no URI, use that tab with
uri
otherwise create a new tab withuri
and make it current for the window.