#!/bin/bash # ^ sourced! command -v slxbrowser || return 0 OPTS=() # Ignore SSL errors [ -n "$SLX_BROWSER_INSECURE" ] && [ "$SLX_BROWSER_INSECURE" -gt 0 ] && OPTS+=("--insecure") # On inactivity, reload every X seconds [ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ] && OPTS+=("--reload-interval" "$SLX_BROWSER_RELOAD_SECS") if [ -n "$SLX_BROWSER_BLACKLIST" ]; then # Turn into file with one entry per line bl="$( mktemp )" sed -r 's/\s+/\n/g' <<<"$SLX_BROWSER_BLACKLIST" > "$bl" OPTS+=("--blacklist" "$bl") # Async, clean up file after slxbrowser read it ( sleep 4; rm -f -- "$bl" ) & fi if [ -n "$SLX_BROWSER_WHITELIST" ]; then wl="$( mktemp )" sed -r 's/\s+/\n/g' <<<"$SLX_BROWSER_WHITELIST" > "$wl" OPTS+=("--whitelist" "$wl") ( sleep 4; rm -f -- "$wl" ) & fi if [ -z "${SLX_AUTOLOGIN%OFF}" ]; then OPTS+=("--maximized") else OPTS+=("--fullscreen") fi if [ -n "$SLX_BROWSER_ZOOM" ]; then OPTS+=( "--zoom" "$SLX_BROWSER_ZOOM" ) fi # HACK: give whatever enough time to whatever it does properly sleep 1 exec slxbrowser "${OPTS[@]}" "$SLX_BROWSER_URL"