mirror of https://github.com/balkian/dotfiles.git
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.
25 lines
425 B
Plaintext
25 lines
425 B
Plaintext
13 years ago
|
#!/bin/bash
|
||
|
if [ "x$1" != "x" ]
|
||
|
then
|
||
|
pgrep -l -u "$USER" -f "$1" | egrep -v "/bin/bash|/bin/sh" | grep -vq "$$"
|
||
|
if [ $? == "0" ]
|
||
|
then
|
||
|
WID=`xdotool search --class $1 | head -1`
|
||
|
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
|
||
|
|