You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dotfiles/one-tmux

29 lines
581 B
Plaintext

#!/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