# HG changeset patch # User Jeff Hammel # Date 1380135246 25200 # Node ID 42d3418e91544c70a5aaf84d5e59da2b4691ffa9 # Parent 772c61f04ccf56869d5a9f4e4bf06f410e8e198e .bashrc bin/setup-X.sh diff -r 772c61f04ccf -r 42d3418e9154 .bashrc --- a/.bashrc Tue Sep 24 21:22:26 2013 -0700 +++ b/.bashrc Wed Sep 25 11:54:06 2013 -0700 @@ -356,6 +356,39 @@ done } +nearest-venv() { +if [[ "$#" == "0" ]] +then +directory=$PWD +else +directory=$1 +fi +directory=$(python -c "import os; print os.path.abspath('${directory}')") + +while [[ "${directory}" != "/" ]] +do +activate="${directory}/bin/activate" +if [ -e "${activate}" ] +then +echo ${directory} +return 0 +fi + +directory=$(dirname ${directory}) + +done +return 1 +} + +activate-nearest() { +nearest=$(nearest-venv) +activate=${nearest}/bin/activate +if [ -e "${activate}" ] +then +. ${activate} +fi +} + recreate-venv() { # recreate a virtualenv VIRTUALENV="virtualenv.py" @@ -522,6 +555,10 @@ source ~/.bash_overrides ### regenerate fluxbox menus here for convenience +if type deactivate &> /dev/null +then +deactivate +fi MENU=~/web/site/programs.html regeneratefluxmenu() { if [ -e $MENU ] diff -r 772c61f04ccf -r 42d3418e9154 bin/setup-X.sh --- a/bin/setup-X.sh Tue Sep 24 21:22:26 2013 -0700 +++ b/bin/setup-X.sh Wed Sep 25 11:54:06 2013 -0700 @@ -4,9 +4,10 @@ # nm-applet: network manager # gkrellm: system monitor # diodon: clipboard manager -# arbtt-capture: arbitrary time tracker (redundant with tracker?) -# To add: x-tile; qamixer (well, some mixer); gnome-activity journal -for i in nm-applet gkrellm diodon arbtt-capture +# arbtt-capture: arbitrary time tracker +# x-tile: window tiling +# To add: qamixer (well, some mixer); gnome-activity journal +for i in nm-applet gkrellm diodon arbtt-capture x-tile do if which ${i} then