#!/bin/env sh

SDDM_THEME_PATH="/etc/sddm.conf.d/theme.conf"

addApplications sddm catppuccin-sddm-theme-mocha

sddm() {
  sudo mkdir -p /etc/sddm.conf.d
  sudo ln ~/.config/sddm/theme.conf /etc/sddm.conf.d/theme.conf

  sudo systemctl enable sddm
}

check() {
  if ! command -v sddm >/dev/null; then
    return 0
  fi

  if [ ! -f "$SDDM_THEME_PATH" ]; then
    return 0
  fi

  return 1
}

if check; then
  addAction sddm
fi
