From c7a322d98d4a6390c80704b62bfde72cb5bdeb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2EFernando=20S=C3=A1nchez?= Date: Thu, 4 Apr 2013 18:13:46 +0200 Subject: [PATCH] Added script to exec commands in a new tmux window --- one-instance | 1 - one-tmux | 28 ++++++++++++++++++++++++++++ one-window | 25 ------------------------- 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100755 one-tmux delete mode 100755 one-window diff --git a/one-instance b/one-instance index acd8ac6..79206ed 100755 --- a/one-instance +++ b/one-instance @@ -4,7 +4,6 @@ then pgrep -l -u "$USER" -f "$1" | egrep -v "/bin/bash|/bin/sh" | grep -vq "$$" if [ $? == "0" ] then - ps aux | grep terminator > /home/balkian/LOG WID=`xdotool search --class $1 | head -1` wmctrl -i -a $WID if [ "x$2" != "x" ] diff --git a/one-tmux b/one-tmux new file mode 100755 index 0000000..dede5ec --- /dev/null +++ b/one-tmux @@ -0,0 +1,28 @@ +#!/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 [extra action]" +fi diff --git a/one-window b/one-window deleted file mode 100755 index e7c919e..0000000 --- a/one-window +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ "x$1" != "x" ] -then - WID=`xdotool search --class $1 | head -1` - if [ "s$WID" != "s" ] - then - ps aux | grep terminator > /home/balkian/LOG - - wmctrl -i -a $WID - if [ "x$2" != "x" ] - then - eval "$2" - fi - else - if [ "x$3" == "x" ] - then - /usr/bin/$1 - else - eval "$3" - fi - fi -else - echo "Usage: one-instance program-name [extra action]" -fi -