#!/bin/bash

# Reload Emacs theme and font to match Omarchy. No-op when the Emacs
# daemon isn't running — otherwise emacsclient exits 1 and any caller
# (e.g. omarchy-hook) reports a spurious "Hook failed" on every theme
# or font change.

if command -v emacsclient &>/dev/null && emacsclient --eval t &>/dev/null; then
  emacsclient --no-wait --eval \
    "(progn (load-file (expand-file-name \"~/.config/emacs/omarchy.el\")) (dolist (f (frame-list)) (with-selected-frame f (omarchy-apply-theme) (omarchy-apply-font))))" \
    2>/dev/null
fi
