mirror of
https://github.com/balkian/dotfiles.git
synced 2024-11-21 19:52:29 +00:00
29 lines
581 B
Bash
Executable File
29 lines
581 B
Bash
Executable File
#!/bin/bash
|
|
if [ "x$1" != "x" ]
|
|
then
|
|
tab=1
|
|
pgrep -l -u "$USER" -f "$1" | egrep -v "/bin/zsh|/bin/bash|/bin/sh" | grep -vq "$$"
|
|
if [ $? != "0" ]
|
|
then
|
|
/usr/bin/$1 &
|
|
sleep 1
|
|
tab=0
|
|
fi
|
|
echo "Bring it on" >> /tmp/prueba.log
|
|
WID=`xdotool search --class $1 | tail -1`
|
|
wmctrl -i -a $WID
|
|
if [ "x$2" != "x" ]
|
|
then
|
|
shift
|
|
if [ $tab == 1 ]
|
|
then
|
|
eval "tmux neww"
|
|
sleep 0.2
|
|
fi
|
|
xdotool type "$*"
|
|
xdotool key Return
|
|
fi
|
|
else
|
|
echo "Usage: $0 <terminal-emulator> [extra action]"
|
|
fi
|