Created
February 3, 2013 06:51
-
-
Save everplays/4700780 to your computer and use it in GitHub Desktop.
initialize guake tabs
This file contains 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 | |
# index of last opened tab | |
lastTabIndex=-1 | |
function runGuake { | |
# run guake in another proccess | |
nohup guake > /dev/null & | |
# wait for guake | |
sleep 5 | |
# rename default tab if we have a name for it | |
if [ "$1" ]; then | |
guake -r $1 | |
fi | |
if [ "$2" ]; then | |
guake -e "$2" | |
fi | |
# increase index of lastTab | |
lastTabIndex=`echo $lastTabIndex+1 | bc` | |
} | |
function newGuakeTab { | |
# create new tab | |
guake -n $1 | |
# rename tab | |
guake -r $1 | |
# increase index of lastTab | |
lastTabIndex=`echo $lastTabIndex+1 | bc` | |
# switch to last tab (FIXME: do we need it?) | |
guake -s $lastTabIndex | |
# execute command in tab if anything passed | |
if [ "$2" ]; then | |
guake -e "$2" | |
fi | |
} | |
sleep 5 | |
runGuake "local" | |
sleep 3 | |
newGuakeTab "alternate" | |
newGuakeTab "www" "cd /srv/http/" | |
newGuakeTab "sudo" "sudo -s" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment