#!/bin/bash

# omarchy:summary=Launch a floating terminal with the Omarchy presentation wrapper
# omarchy:args=<command>

cmd="$*"
presentation_script="omarchy-show-logo; $cmd; if (( \$? != 130 )); then omarchy-show-done; fi"

shell_quote() {
  local value=$1

  printf "'"
  printf "%s" "$value" | sed "s/'/'\\\\''/g"
  printf "'"
}

terminal_command="setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal --title=Omarchy -e bash -c $(shell_quote "$presentation_script")"
exec omarchy-hyprland-launch "$terminal_command"
