Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Kragen Javier Sitaker Newsgroups: comp.windows.x Subject: Re: a battery monitor Date: Wed, 02 Sep 2026 00:52:56 -0300 Organization: Primarily biological and memetic Lines: 23 Message-ID: <877bl48g2v.fsf@debian> References: <87v78oop87.fsf@safunu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 02 Sep 2026 03:53:01 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2521229"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qWTuRB+INfW8//rV6LePl"; posting-host="de81ddf0846fce2f7070364d1569cfb9" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cancel-Lock: sha1:H/qNYshIU6FoUzP1HwwYuc6DUFM= sha1:iSLeG/IG67NYBsSdXRtdGP+k83A= sha256:+wv+UrIn7R/Gf1HnTslWu3TK/ALBSe65eDuGHf9RRHc= sha1:PPEqhzcMDxBteWe7lLaIfqpF640= sha256:p89kDdhfV1ORutKsapxoY7RvRJ1KoD09t88UOuKBZgs= Xref: csiph.com comp.windows.x:624 Anton Antimo writes: > So, yes, the program is more like a progress bar to be used by some kind > of shell program. Here's how I've been using it. My system has this > program called acpi, which gives me battery information: > > %acpi -b > Battery 0: Charging, 91%, 00:18:43 until charged > > I run CWM, the calm window manager. So from my ~/xinitrc, I run: > > while true; \ > do acpi -b | awk '{printf("%d\n",$4)}' | tr -d '%,' && sleep 60; \ > done | xbattery 220x40-0-0 & This is a good idea! X-Windows makes it a lot more trouble to write than it really ought to be. In theory, it ought to be doable in much less code, but X really makes your life hard there. (I haven’t tested the code, but I assume you’re posting a working version, and the code looks fine at a glance, so I'm sure it’s fine.) Kragen