Friday, October 12, 2007

Cool OS-X program

There is a great program called Witch which basically is an improvement on Windows style ALT-TAB.

Monday, October 8, 2007

Setting Up Environment Variables in Ubuntu (and probably Debian)

I was having problems getting my environment set up correctly when logging into my Ubuntu machine from the gdm login prompt. The nature of the problem is that bash is never started unless you create a terminal window. If bash is never started, then ~/.bashrc, ~/.bash_profile, etc., never get run. For many people I suppose this isn't a problem, but for me, when I start Emacs via the drop-down menus in the window manager, I wanted my environment variables, like PATH and various perforce environment varaibles, to be already loaded.

The solutions on the web I found in the top 100 google hits for (ubuntu enviornment variables) were all pretty terrible as they suggested changing the system wide settings in /etc/profile and other things that would make it harder for me to use other machines in my organization.

The solution I am using instead is to create an executable ~/.Xsession file which sources the script which sets up my environment variables and then execs /usr/bin/x-session-manager. In between, it is convenient to launch a few extra programs to run as well. So here is my script:


#!/bin/bash

# Force environment variables to get loaded before our window manager starts.
# Perhaps I should just load .bash_profile here but .bashrc will load that
# automatically if necessary.
source ~/.bashrc

# Start up some programs here.
xterm &

# Now, invoke the normal gnome/ubuntu login stuff.
exec /usr/bin/x-session-manager


Hope this saves you a little time and frustration.

About Me

My photo
I'm currently a software engineer at Google though I've worked at other companies as well.