#!/usr/bin/env bash

function overlay_file() {
    local SYSTEM_FILE="/usr/share/ubuntu-mate/settings-overlay/${1}"
    local USER_FILE="${HOME}/.${1}"
    local USER_DIR=$(dirname "${USER_FILE}")
    if [ ! -f "${USER_FILE}" ]; then
        mkdir -p "${USER_DIR}"
        cp "${SYSTEM_FILE}" "${USER_FILE}"
    fi
}

if [ ! -d "${HOME}/.config/plank/dock1" ]; then
    overlay_file config/plank/dock1/settings
    overlay_file config/plank/dock1/launchers/firefox.dockitem
    overlay_file config/plank/dock1/launchers/matecc.dockitem
    if [ -f /usr/bin/thunderbird ]; then
        overlay_file config/plank/dock1/launchers/thunderbird.dockitem
    fi
    if [ -f /usr/bin/vlc ]; then
        overlay_file config/plank/dock1/launchers/vlc.dockitem
    fi
fi
overlay_file config/folder-color/hide_donation
overlay_file config/Trolltech.conf
