#!/usr/bin/bash
# Apply ZypherOS Kinetic's per-user defaults to this account, at the start of
# each COSMIC session (from /etc/profile.d/kinetic-cosmic.sh). Most of
# Kinetic's COSMIC defaults are system defaults COSMIC reads itself; this is
# for what only lives in each user's own files.
#
# Each step runs once per account; the record is in ~/.local/state/kinetic.
set -u

(($(id -u) >= 1000)) || exit 0

config="${XDG_CONFIG_HOME:-${HOME}/.config}"
state="${XDG_STATE_HOME:-${HOME}/.local/state}/kinetic"
mkdir -p "${config}" "${state}" || exit 0

# Chromium starts on a new tab. Its first-run sequence shows an empty
# "Additional Terms of Service" dialog (a placeholder in non-Google builds)
# and opens Fedora's start page; marking the first run done skips both. Only
# for accounts that haven't used Chromium yet.
if [[ ! -e "${state}/chromium-first-run-0.2.0" ]]; then
	if [[ ! -e "${config}/chromium" ]]; then
		mkdir -p "${config}/chromium" && touch "${config}/chromium/First Run"
	fi
	touch "${state}/chromium-first-run-0.2.0"
fi

exit 0
