#!/bin/bash
# This script will be called after i3 starts. It's purpose is to do things
# that only make sense for the first time the user starts Regolith.

UPDATE_FLAG_DIR="$HOME/.config/regolith3/flags"
UPDATE_FLAG_PATH="$UPDATE_FLAG_DIR/show-shortcuts"
TERM_PROFILE_PATH="$UPDATE_FLAG_DIR/term-profile"
TERM_PROFILE_ENABLED="$(xrescat gnome.terminal.update true)"

if [ ! -f "$UPDATE_FLAG_PATH" ]; then
    if [ -f /usr/share/regolith-look/default/ilia.css  ]; then
        ilia -p keybindings -a -t /usr/share/regolith-look/default/ilia.css &
    else
        ilia -p keybindings -a &
    fi    

    mkdir -p "$UPDATE_FLAG_DIR"
    touch "$UPDATE_FLAG_PATH"
fi

if [[ ! -z "$(command -v gnome-terminal 2> /dev/null)" && "$TERM_PROFILE_ENABLED" == "true" && ! -f "$TERM_PROFILE_PATH" ]]; then
    /usr/share/regolith-ftue/regolith-init-term-profile

    touch "$TERM_PROFILE_PATH"
fi
