Created
March 23, 2010 13:45
-
-
Save sirupsen/341179 to your computer and use it in GitHub Desktop.
Just a single terminal. Please.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
WINTITLE="sakura" # Name of the window (or part of it) | |
PROGRAMNAME="sakura" # Name of the program, so it can be opened if there's no window currently | |
# Lists all windows, if there's one containing $WINTITLE it'll return 1, and bring the current instance of the program to the front. | |
if [ `wmctrl -l | grep -c "$WINTITLE"` != 0 ] | |
then | |
wmctrl -a "$WINTITLE" | |
# Else, it'll launch a new instance | |
else | |
$PROGRAMNAME & | |
fi | |
# We're good! | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://blog.sirupsen.dk/script-fu/one-terminal-just-one/