#!/usr/bin/env bash

# omarchy:summary=Print the compositor this process runs under
# omarchy:hidden=true

# hyprland or sway, in the order the shell's Compositor singleton reads the
# session's variables: HYPRLAND_INSTANCE_SIGNATURE first, so a session carrying
# both is Hyprland's. Only a caller with neither (ssh, a TTY) recovers the
# session from the runtime dir, through the named gates.
if [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then
  echo hyprland
elif [[ -n ${SWAYSOCK:-}${I3SOCK:-} ]]; then
  echo sway
elif "${BASH_SOURCE[0]%/*}/omarchy-on-hyprland"; then
  echo hyprland
elif "${BASH_SOURCE[0]%/*}/omarchy-on-sway"; then
  echo sway
else
  exit 1
fi
