Assorted battery#
Mon, 16 Jun 2008 15:58:08 +0000
I bought a new battery for my laptop (the working one, not the old one with the bust disk) quite recently, but having not left home with it much lately it's been running mostly on mains power ever since. Initial impressions are that the upgrade from three-cell to six-cell has taken battery life from [[about two hours => Watt Support?]] to somewhere in the region of five. But I haven't really been keeping track.
After ten minutes looking for battery monitors that don't demand I change window managers, convert to Gnome, convert to KDE, convert to Islam or convert to metric, I gave up and wrote my own. Well, sort of.
- install ibam (it's in debian)
- create a sawfish command to call it and print the result
:; cat ~/.sawfish/lisp/ibam-battery-monitor.jl (require 'rep.io.timers) ; (setq blank-ibam-timer nil) (defun ibam-show-battery () (when blank-ibam-timer (delete-timer blank-ibam-timer) (setq blank-ibam-timer nil)) (let* ((s (make-string-output-stream)) (e (x-events-queued)) (p (make-process s))) (call-process p nil "/bin/sh" "-c" (format nil "ibam")) (let ((str (get-output-stream-string s))) (display-message (substring str 0 (- (length str) 1))) (setq blank-ibam-timer (make-timer (lambda () (display-message nil)) 0 3000))))) ; (define-command 'ibam-battery-monitor (lambda () (ibam-show-battery))) (provide 'ibam-battery-monitor)
- enable the i-in-a-circle "key" on the laptop's touch-sensitive strip (apparently this is supposed to take one to the HP Info Center)
xmodmap -e 'keycode 245 = XF86VendorHome'
(245 is the code thatxev
says is produced by pressing that,XF86VendorHome
is any keysym in/usr/share/X11/XKeysymDB
that's not in use for something else)
- run
sawfish-client
and(require 'ibam-battery-monitor)
- and put the same text in a sawfish startup file for next time - use sawfish-ui to bind the new key to the new command
No external programs required other than ibam itself