My recommendation is that instead of a warning at login you simply have an item placed into the status bar on the top of your screen that updates every minute, saying how much space you have. That way you always have the free space value easily visible. I'm going for lunch now so I can't write that for you for a while.
Usual caveats about Apple's wacky disk space reporting apply -- for example, df's "Available Space" doesn't include purgeable -- so don't be surprised when every method you use gives you a different answer!
That said, I like @Evan_Mangiamele's above because it is conservative, using powers of 1024 rather than 1000 and considering purgeable space to be unavailable. Much better to under- rather than over-estimate your available elbow-room.
I spent the whole day working on an interesting solution. My solution is large enough to merit its own post on another thread on this site. I'll post it in about 2 minutes.
Thanks for both solutions.
I have selected Evan_Mangiamele 's although it was a close call between them.
I have modded it to a "silent" version that is now included with a cron job I run every 15 minutes. Silent i.e. only notify me if running out of disk space.