#!/usr/bin/bash

DIR="$HOME/.config/firejail"
FILE="chromium.local"
SHOWPROFILE=false

if $SHOWPROFILE; then
    if [ -f "/etc/firejail/chromium.profile" ]; then
        echo
        echo "Contents of file /etc/firejail/chromium.profile"
        echo "---------- Start of file ----------"
        cat /etc/firejail/chromium.profile
        echo "---------- End of file ----------"
        echo
    fi
fi

mkdir -p "$DIR"

# Fix Chromium/Brave startup under Firejail:
cat > "$DIR/$FILE" <<'EOF'
whitelist /usr/share/xkeyboard-config-2
read-only /usr/share/xkeyboard-config-2
EOF

echo
echo "Created \"$DIR/$FILE\" with content:"
echo "---------- Start of file ----------"
cat "$DIR/$FILE"
echo "---------- End of file ----------"
echo
echo "You should now be able to start Chromium with:"
echo
echo "    firejail chromium"
echo
echo "Done."
exit 0