#!/bin/bash

# omarchy:summary=Install the Hermes desktop app
# omarchy:requires-sudo=true

set -e

if (( EUID == 0 )); then
  echo "Run this command as your desktop user, without sudo." >&2
  exit 1
fi

# The package goes in here, before the runtime installer runs, because the
# installer stands aside for a Hermes the user set up themselves only while the
# app is absent. Asked for by name, the app needs the runtime it prepares.
echo "Installing Hermes Desktop..."
omarchy-pkg-add hermes-desktop
omarchy-install-hermes-cli --now

echo "Opening Hermes Desktop..."
setsid uwsm-app -- /usr/bin/hermes-desktop >/dev/null 2>&1 &

echo ""
echo "Hermes Desktop has been installed."
