#!/bin/bash

# This script choose and run right terminal emulator
# for Pearl applications
# Created by Paweł "scottvandergrift' Pijanowski 2015/02/28
# Copyright 2015 under the GNU GPL2 License
# Last update 2016/03/17

if [ $(pidof enlightenment) ] && [ -f /usr/bin/terminology ]; then
	/usr/bin/terminology "$@"
elif [ $(pidof marco) ] && [ -f /usr/bin/mate-terminal ]; then
	/usr/bin/mate-terminal "$@"
elif [ $(pidof openbox) ] && [ -f /usr/bin/qterminal ]; then
	/usr/bin/qterminal "$@"
elif [ $(pidof openbox) ] && [ -f /usr/bin/lxterminal ]; then
	/usr/bin/lxterminal "$@"
elif [ $(pidof kwin_x11) ] && [ -f /usr/bin/xterm ]; then
	/usr/bin/xterm "$@"
elif [ $(pidof cinnamon) ] && [ -f /usr/bin/xterm ]; then
	/usr/bin/xterm "$@"
elif [ $(pidof metacity) ] && [ -f /usr/bin/xterm ]; then
	/usr/bin/xterm "$@"
elif [ $(pidof gnome-shell) ] && [ -f /usr/bin/xterm ]; then
	/usr/bin/xterm "$@"
elif [ $(pidof gala) ] && [ -f /usr/bin/xterm ]; then
	/usr/bin/xterm "$@"
else
	if [ -f /usr/bin/xterm ]; then
		/usr/bin/xterm "$@"
	else
		x-terminal-emulator "$@"
	fi
fi

