#!/usr/bin/env bash

word="$(rofi -dmenu -i -p "Define:" -theme ~/.config/rofi/menu-no-list.rasi)"
TERMINAL="ghostty"


if [[ -n $word ]]; then
    case "$TERMINAL" in
        "kitty"|"ghostty")
            $TERMINAL --title="Dictionary" -e ~/.local/bin/show_def "$word"
            ;;
        "wezterm")
            $TERMINAL start --new-tab -e ~/.local/bin/show_def "$word"
            ;;
        "alacritty")
            $TERMINAL --class "Dictionary" --hold \
                -e /bin/zsh -c "$HOME/.local/bin/show_def '$word'"
            ;;
        *)
            exit 1
        ;;
    esac
fi

