#!/bin/bash -- sourced # prepares and run chromium as kiosk browser command -v chromium-browser || return 0 # clear state of previous sessions if [ "$(whoami)" = "demo" ]; then rm -rf -- "$HOME/.config/chromium" mkdir -p "$HOME/.config/chromium/Default" fi # Helper to json'ize bookmarks given as arguments in the form: # , -> e.g. Google,https://www.google.com json_bookmarks() { local cur=0 while [ $# -ne 0 ]; do jq --null-input --join-output --compact-output --arg id "$(( cur++ ))" --arg name "${1%%,*}" --arg url "${1#*,}" \ '{"id": $id, "type": "url", "name": $name, "url": $url}' shift [ $# -ne 0 ] && printf "," done } # Pass SLX_BROWSER_BOOKMARKS without quotes for splitting into arguments cat > "$HOME/.config/chromium/Default/Bookmarks" < "$HOME/.xbindkeysrc" "true" Control+d "true" Control+t "true" Control+s "true" Control+n "true" Control+j "true" Control+p "true" Control+h "true" Control+Shift+o EOF # xbinkeys requires a daemon, run it xbindkeys_autostart & if [ -n "$SLX_BROWSER_RELOAD_SECS" ]; then while true; do xdotool windowactivate "$(xdotool search --onlyvisible --class browser)" xdotool key Alt+Home sleep "$SLX_BROWSER_RELOAD_SECS" done & fi fi if [ -n "$SLX_BROWSER_INSECURE" ]; then chromium_args+=("--allow-running-insecure-content" "--ignore-certificate-errors") fi # finally exec to chromium exec chromium-browser "${chromium_args[@]}"