Skip to content

Instantly share code, notes, and snippets.

@hosh
Created July 23, 2009 13:56
Show Gist options
  • Save hosh/152950 to your computer and use it in GitHub Desktop.
Save hosh/152950 to your computer and use it in GitHub Desktop.
#!/bin/sh
# README:
# Having had to use MacOSX, I still prefer using Visor + MacVIM. However, Visor uses Terminal.app.
# Unlike iTerm, Terminal does not support changing the name of the tab. There are two hacks out in
# the wild:
# (1) Run a background process with the name you want to use
# (2) Hardlink ssh, then call that hardlinked ssh
#
# This script automates the method (2), however, instead of using ssh, we use screen. This has the
# additional bonus of being able to access screen's ability to detach sessions.
# INSTALLING:
# Save this to ~/bin/workon (and add ~/bin to your path)
# USAGE:
# workon rails
# workon rails-console
# workon rails-test
# Configure for your system
SCREENS=${HOME}/bin/.screens
SCREENBIN=/usr/bin/screen
DEFAULT_WORKSPACE='general-git'
# Sets default workspace
WORKSPACE=${1}
if [ -z ${WORKSPACE} ]; then
WORKSPACE=${DEFAULT_WORKSPACE}
fi
if [ ! -d ${SCREENS} ]; then
mkdir -p ${SCREENS}
fi
if [ ! -e ${SCREENS}/${WORKSPACE} ]; then
ln ${SCREENBIN} ${SCREENS}/${WORKSPACE}
fi
${SCREENS}/${WORKSPACE} -S ${WORKSPACE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment