Skip to content

Instantly share code, notes, and snippets.

@everplays
Created February 3, 2013 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everplays/4700780 to your computer and use it in GitHub Desktop.
Save everplays/4700780 to your computer and use it in GitHub Desktop.
initialize guake tabs
#!/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