webengine_kiosk v0.2.4 WebengineKiosk
Control a fullscreen web browser using Elixir for use in a kiosk.
Link to this section Summary
Functions
Go to the previously visited page
Blank the screen
Returns a specification to start this module under a supervisor
Go forward in history
Request that the browser go to the homepage
Request that the browser go to the specified URL
Invoked when the server is started. start_link/3
or start/3
will
block until it returns
Reload the current page
Run Javascript in the browser
Set the zoom factor for displaying the page
Start the kiosk
Stop the kiosk
Stop loading the current page
Unblank the screen
Link to this section Functions
Go to the previously visited page.
Blank the screen
The web browser will be replaced by a screen with the blank_image
. If
someone clicks or taps on the screen then a wakeup message will be sent.
While the screen is in the blank state, it can still accept requests to go to
other URLs.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Go forward in history.
Request that the browser go to the homepage.
go_to_url(GenServer.server(), String.t()) :: :ok | {:error, term()}
Request that the browser go to the specified URL.
Invoked when the server is started. start_link/3
or start/3
will
block until it returns.
args
is the argument term (second argument) passed to start_link/3
.
Returning {:ok, state}
will cause start_link/3
to return
{:ok, pid}
and the process to enter its loop.
Returning {:ok, state, timeout}
is similar to {:ok, state}
except handle_info(:timeout, state)
will be called after timeout
milliseconds if no messages are received within the timeout.
Returning {:ok, state, :hibernate}
is similar to {:ok, state}
except the process is hibernated before entering the loop. See
c:handle_call/3
for more information on hibernation.
Returning {:ok, state, {:continue, continue}}
is similar to
{:ok, state}
except that immediately after entering the loop
the c:handle_continue/2
callback will be invoked with the value
continue
as first argument.
Returning :ignore
will cause start_link/3
to return :ignore
and
the process will exit normally without entering the loop or calling
c:terminate/2
. If used when part of a supervision tree the parent
supervisor will not fail to start nor immediately try to restart the
GenServer
. The remainder of the supervision tree will be started
and so the GenServer
should not be required by other processes.
It can be started later with Supervisor.restart_child/2
as the child
specification is saved in the parent supervisor. The main use cases for
this are:
- The
GenServer
is disabled by configuration but might be enabled later. - An error occurred and it will be handled by a different mechanism than the
Supervisor
. Likely this approach involves callingSupervisor.restart_child/2
after a delay to attempt a restart.
Returning {:stop, reason}
will cause start_link/3
to return
{:error, reason}
and the process to exit with reason reason
without
entering the loop or calling c:terminate/2
.
Callback implementation for GenServer.init/1
.
Reload the current page.
run_javascript(GenServer.server(), String.t()) :: :ok | {:error, term()}
Run Javascript in the browser.
set_zoom(GenServer.server(), number()) :: :ok | {:error, term()}
Set the zoom factor for displaying the page.
start_link(Keyword.t(), GenServer.options()) :: {:ok, pid()} | {:error, term()}
Start the kiosk.
The kiosk starts fullscreen and goes to a default local web page. To change this, set one or more options:
background_color: color
- specify a background color as #RRGGBB or by nameblank_image: path
- specify a path to an image for when the screen is blankeddata_dir: path
- specify a writable path for data filesdebug_keys: boolean
- enable key combinations useful for debuggingfullscreen: boolean
- show fullscreengid: gid
- run the browser with this group idhomepage: url
- load this page first. For local files, specifyfile:///path/to/index.html
monitor: index
- select the monitor for the web browser (0, 1, etc.)opengl: "gl" | "gles" | "software" | "auto"
- specify the OpenGL backend. This is only a hint.progress: boolean
- show a progress bar when loading pagesrun_as_root: boolean
- set to true if you really want to run Chromium as rootsounds: boolean
- play sounds on clicksuid: uid
- run the browser as this user
Untested:
clear_cache: boolean
proxy_enable: boolean
- enable/disable proxy supportproxy_system:
-proxy_host: hostname
- the host to connect to for using a proxyproxy_port: port
- the port to connect to on the proxyproxy_username: username
- a username for the proxyproxy_password: password
- a password for the proxystay_on_top: boolean
-window_clicked_sound: url
- a sound to play when the window is clickedlink_clicked_sound: url
- a sound to play when a link is clickedhide_cursor: boolean
- show or hide the mouse pointerjavascript: boolean
- enable or disable Javascript supportjavascript_can_open_windows: boolean
- allow Javascript to open windowswidth: pixels
- when not fullscreen, the window is this widthheight: pixels
- when not fullscreen, the window is this height
Stop the kiosk
stop_loading(GenServer.server()) :: :ok | {:error, term()}
Stop loading the current page.
Unblank the screen
Show the web browser again.