#!/bin/bash

# omarchy:summary=Refresh the current theme from its templates.

THEME_NAME_PATH="$HOME/.local/state/omarchy/current/theme.name"

# Installers and migrations refresh the theme and then read the app configs it
# writes, so this waits for every retint rather than leaving some running.
# Skip Hyprland reloads while the compositor binary was replaced by an update,
# so this refresh does not bypass omarchy-hyprland-reload-guard.
if [[ -f $THEME_NAME_PATH ]]; then
  OMARCHY_THEME_WAIT=1 OMARCHY_THEME_SKIP_BACKGROUND=1 OMARCHY_RELOAD_SKIP_REPLACED=1 omarchy-theme-set "$(cat "$THEME_NAME_PATH")"
fi
