webengine_kiosk v0.2.5 WebengineKiosk View Source

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.

Stop the kiosk

Stop loading the current page.

Unblank the screen

Link to this section Functions

Link to this function

back(server)

View Source
back(GenServer.server()) :: :ok | {:error, term()}

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.

Link to this function

forward(server)

View Source
forward(GenServer.server()) :: :ok | {:error, term()}

Go forward in history.

Link to this function

go_home(server)

View Source
go_home(GenServer.server()) :: :ok | {:error, term()}

Request that the browser go to the homepage.

Link to this function

go_to_url(server, url)

View Source
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.

init_arg 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 that it also sets a timeout. See the "Timeouts" section in the module documentation for more information.

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 calling Supervisor.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.

Link to this function

reload(server)

View Source
reload(GenServer.server()) :: :ok | {:error, term()}

Reload the current page.

Link to this function

run_javascript(server, code)

View Source
run_javascript(GenServer.server(), String.t()) :: :ok | {:error, term()}

Run Javascript in the browser.

Link to this function

set_zoom(server, factor)

View Source
set_zoom(GenServer.server(), number()) :: :ok | {:error, term()}

Set the zoom factor for displaying the page.

Link to this function

start_link(args, genserver_opts \\ [])

View Source
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 name
  • blank_image: path - specify a path to an image for when the screen is blanked
  • data_dir: path - specify a writable path for data files
  • debug_keys: boolean - enable key combinations useful for debugging
  • fullscreen: boolean - show fullscreen
  • gid: gid - run the browser with this group id
  • homepage: url - load this page first. For local files, specify file:///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 pages
  • run_as_root: boolean - set to true if you really want to run Chromium as root
  • sounds: boolean - play sounds on clicks
  • uid: uid - run the browser as this user

Untested:

  • clear_cache: boolean
  • proxy_enable: boolean - enable/disable proxy support
  • proxy_system: -
  • proxy_host: hostname - the host to connect to for using a proxy
  • proxy_port: port - the port to connect to on the proxy
  • proxy_username: username - a username for the proxy
  • proxy_password: password - a password for the proxy
  • stay_on_top: boolean -
  • window_clicked_sound: url - a sound to play when the window is clicked
  • link_clicked_sound: url - a sound to play when a link is clicked
  • hide_cursor: boolean - show or hide the mouse pointer
  • javascript: boolean - enable or disable Javascript support
  • javascript_can_open_windows: boolean - allow Javascript to open windows
  • width: pixels - when not fullscreen, the window is this width
  • height: pixels - when not fullscreen, the window is this height

Stop the kiosk

Link to this function

stop_loading(server)

View Source
stop_loading(GenServer.server()) :: :ok | {:error, term()}

Stop loading the current page.

Unblank the screen

Show the web browser again.