#!/bin/sh
class=com.sjb.$1
title=$1
cmd=$2
case "$XDG_TERMINAL" in
  footclient|foot)
    terminal="$XDG_TERMINAL -a $class -T $title"
    ;;
  ghostty)
    terminal="ghostty --class=$class --title=$title -e"
    ;;
  *)
    printf 'Unsupported XDG_TERMINAL: %s\n' "$XDG_TERMINAL" >&2
    exit 1
    ;;
esac
hyprctl dispatch "focus_or_launch({ match = '$class', cmd = '$terminal $cmd'})"
