1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-21 19:52:29 +00:00
dotfiles/one-tmux
2013-04-04 19:00:57 +02:00

28 lines
593 B
Bash
Executable File

#!/bin/bash
TERMINAL_EMULATOR='xfce4-terminal'
tab=1
pgrep -l -u "$USER" -f "$TERMINAL_EMULATOR" | egrep -v "/bin/zsh|/bin/bash|/bin/sh" | grep -vq "$$"
if [ $? != "0" ]
then
/usr/bin/$TERMINAL_EMULATOR &
sleep 1
tab=0
fi
WID=`xdotool search --class $TERMINAL_EMULATOR | tail -1`
wmctrl -i -a $WID
if [ "x$1" != "x" ]
then
if [ "x$1" == "xhelp" ]
then
echo "Usage: $0 [command-in-new-window]"
else
if [ $tab == 1 ]
then
eval "tmux neww"
sleep 0.2
fi
xdotool type "$*"
xdotool key Return
fi
fi