changeset 531:42d3418e9154

.bashrc bin/setup-X.sh
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 25 Sep 2013 11:54:06 -0700
parents 772c61f04ccf
children e1aa8835edb7
files .bashrc bin/setup-X.sh
diffstat 2 files changed, 41 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 ]
--- 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