Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.windows.x > #628
| From | Eli the Bearded <*@eli.users.panix.com> |
|---|---|
| Newsgroups | comp.windows.x |
| Subject | Re: a battery monitor |
| Date | 2026-09-03 05:30 +0000 |
| Organization | Some absurd concept |
| Message-ID | <eli$2609030059@qaz.wtf> (permalink) |
| References | <87v78oop87.fsf@safunu.org> <117a5eg$35q9q$4@dont-email.me> <vN6mS.143748$hGY7.116085@fx16.ams4> |
The original post had a "Followup-To: comp.windows.x" at the end of the source. I presume that was the intention, so I've trimmed newsgroups. In comp.windows.x, Johann 'Myrkraverk' Oskarsson wrote: > On 03/09/2026 5:45 AM, Lawrence D'Oliveiro wrote: > > On Tue, 01 Sep 2026 14:28:40 -0300, Anton Antimo wrote: > >> So, yes, xbattery.c (source code below) is able to read the desired > >> window geometry from the command line (as it's typical of X > >> programs). Fun. An obvious improvement would be to allow colors to be set on the command line, or as XResources, instead of being hard coded. Also maybe be able to set the color change threshold. I use a solid green background for my root window. It's not the same shade as your green, but close enough. An advanced option would be to have a rotation. Tall or draining right instead of the left. When I have needed a standalone battery monitor, I used the system file with battery status and displayed a number in Lemonbar: https://github.com/X11-good-tools/lemonbar Which works like your tool, taking content on stdin and displaying it, refreshing when there is a line of input. And used /proc/acpi/battery/ files for data. It seems that's an older pattern, and /sys/class/power_supply/ files are used now: $ cat /sys/class/power_supply/BAT1/status Charging $ cat /sys/class/power_supply/BAT1/charge_now 3673000 $ cat /sys/class/power_supply/BAT1/charge_full 4220000 $ cat /sys/class/power_supply/BAT1/alarm 420000 The /sys/class/power_supply/BAT1/uevent file exposes most of settings in a way suitable for eval-ing in a shell script. $ grep -i charg /sys/class/power_supply/BAT1/uevent POWER_SUPPLY_STATUS=Charging POWER_SUPPLY_CHARGE_FULL_DESIGN=4265000 POWER_SUPPLY_CHARGE_FULL=4220000 POWER_SUPPLY_CHARGE_NOW=3673000 >> Instead of writing all that C code, why not using a preexisting >> GUI utility that can display simple widgets like progress bars, >> under the control of a shell script? > Dear Lawrence, > What kind of /moron/ are you? Can't you understand that Anton is writ- > ing his code for his own amusement and education? Lawrence is the sort of guy who always wants to have a reply. Elijah ------ does not expect useful replies from Lawrence on a regular basis
Back to comp.windows.x | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
a battery monitor Anton Antimo <anton@safunu.org> - 2026-09-01 14:28 -0300
Re: a battery monitor Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-02 00:52 -0300
Re: a battery monitor Anton Antimo <anton@safunu.org> - 2026-09-02 12:22 -0300
Re: a battery monitor Anton Antimo <anton@safunu.org> - 2026-09-11 16:58 -0300
Re: a battery monitor Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-02 21:45 +0000
Re: a battery monitor Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-03 12:34 +0800
Re: a battery monitor Eli the Bearded <*@eli.users.panix.com> - 2026-09-03 05:30 +0000
Re: a battery monitor Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-03 21:24 +0000
Re: a battery monitor Eli the Bearded <*@eli.users.panix.com> - 2026-09-04 02:51 +0000
Re: a battery monitor David Brown <david.brown@hesbynett.no> - 2026-09-03 09:28 +0200
Re: a battery monitor boltar@caprica.universe - 2026-09-03 15:55 +0000
Re: a battery monitor David Brown <david.brown@hesbynett.no> - 2026-09-04 09:07 +0200
Re: a battery monitor Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-04 15:14 +0800
Re: a battery monitor Lane W <cactus_DAC@yahoo.com> - 2026-09-04 05:32 -0600
Re: a battery monitor scott@slp53.sl.home (Scott Lurndal) - 2026-09-04 14:29 +0000
Re: a battery monitor Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-04 23:17 +0800
Re: a battery monitor boltar@caprica.universe - 2026-09-05 09:39 +0000
Re: a battery monitor gazelle@shell.xmission.com (Kenny McCormack) - 2026-09-04 12:05 +0000
Re: a battery monitor Anton Antimo <anton@safunu.org> - 2026-09-02 18:48 -0300
csiph-web