I'd just get the current life of the battery (as you would normally pipe it to xsetroot, using acpi or whatnot), then, if you want a popup window, check the state everytime you update the rootname, and pipe something to Zenity if it is at 10% or less. If it is at 0% run 'zzz' (or however you suspend on Linux).
Sorry for the lack of real information, on a Windows box at work. --Sean
