#!/bin/sh
# Espanso wrapper: auto-select backend based on session type
if [ -n "$WAYLAND_DISPLAY" ] && [ -x /usr/bin/espanso-wayland ]; then
    exec /usr/bin/espanso-wayland "$@"
elif [ -x /usr/bin/espanso-x11 ]; then
    exec /usr/bin/espanso-x11 "$@"
elif [ -x /usr/bin/espanso-wayland ]; then
    exec /usr/bin/espanso-wayland "$@"
else
    echo "Error: no espanso backend installed (espanso-x11 or espanso-wayland)" >&2
    exit 1
fi
