Tweak powerapplet_tray external charging
I posted about using Claude AI to detect battery types other than BAT0 and BAT1:
- Fix powerapplet find battery in laptop — November 19, 2026
However, I noticed a difference from the original code; when the external power adapter is plugged in, but battery is at 100% so no longer charging, sometimes the tray icon was a red colour and mouse-over stated "Battery discharging, capacity 100%". I reported this to Claude:
In the original code, when the external power is plugged in
and the charge has reached 100%, mouseover the tray icon says
"Battery charging, capacity 100%" and the icon in the tray is
color blue. However, your code says "Battery discharging,
capacity 100%" and icon is red color, which is misleading. I
think that when the external power is plugged in, the tray icon
should always be color blue.
Claude responded:
That's a regression from my change, not your original logic.
The original treats the battery as charging unless sysfs says
"Discharging". I added "Not charging" as a discharging state,
and many laptops report "Not charging" or "Full" at 100% on AC.
I'll remove that and also check the AC adapter directly, so
plugged-in always shows blue.
I've fixed it. The regression was my "Not charging" line, which
I've removed.
There are two changes in the sysfs branch of `Update()`:
- **Original behaviour restored:** the battery counts as
charging unless its status is exactly "Discharging". "Full" and
"Not charging" at 100% on AC now show the blue icon and "Battery
charging, capacity 100%", as in your original.
- **AC check added:** a new `ac_online()` function looks for a
non-battery supply in `/sys/class/power_supply` (the AC adapter
or a USB-C charger) with `online` = 1. If the battery reports
"Discharging" while external power is connected, as some laptops
do near a charge limit, the applet now treats that as charging
too, so the icon stays blue whenever you're plugged in.
I haven't built or run this. The sandbox has no GTK headers and
no power supplies, so I only compiled `ac_online()` on its own.
It ran and returned 0, which is correct there. Please run
`./compile` and test it on your laptop.
The updated `powerapplet_tray.c` is the file to use. The patch
is attached as `battery-detect.patch.txt`, a diff against your
original upload that includes both the detection fix and this
one.
I have bumped powerapplet_tray PET to version
3.4.
Tags: easy
EasyOS version 7.5.4 released
Here are the highlights since version 7.5.3:
- Fix powerapplet find battery in laptop — November 19, 2026
- ROX-Filer thumbnails patch — November 19, 2026
- Fix convert pup_event_ipc.bac to C — November 18, 2026
- gcc14 patch for ROX-Filer — November 18, 2026
- Fix Easy Containers accelerated graphics checkbox — November 18, 2026
- pup-tools utilities converted from bacon and nim to C — November 17, 2026
- Cleanup user-installed packages when version update — November 17, 2026
- Fix kexec in 6.6.x kernel — November 16, 2026
- Slightly wider EasyJWM window — November 16, 2026
- EasyApps fix missing apps — November 16, 2026
- YouTube tutorial kernel rollback — November 15, 2026
- Detect builtin wl.ko when EasyOS update — November 15, 2026
A lot has happened!
Unfortunately, uploading to ibiblio.org is broken, has been for 4-5 days. Discussion here:
https://forum.puppylinux.com/viewtopic.php?t=17743
So, the desktop "update" icon won't work.
Instead, I have uploaded 7.5.4 to easyos.org:
https://easyos.org/releases/7.5.4/
You will need to download the .img file, then do a manual update. It's very simple, see lower down the page on this update tutorial:
https://easyos.org/user/how-to-update-easyos.html
My URLs bkhome.org and easyos.org are on a shared-hosting account, so might get a complaint from the hosting company if do lots of big downloads. What is really needed is an alternative to ibiblio.org, that we can fallback to. It would need to handle lots of downloads and have an rsync server.
Feedback welcome at the forum:
https://forum.puppylinux.com/viewtopic.php?p=180237#p180237
Have fun!
Tags: easy
Fix powerapplet find battery in laptop
Forum member Vverve posted a fix for powerapplet_tray that finds the battery on his laptop:
https://forum.puppylinux.com/viewtopic.php?p=180195#p180195
I'm on a roll last couple of days with Claude AI, so gave it the source of powerapplet_tray v3.2, and asked:
This is a Linux tray application that monitors battery status
in a laptop, displays percentage charge and warns when battery
low. The problem is that it does not detect the battery on some
laptops. Can you suggest a change that will fix this?
Claude responded:
I've patched it so the applet finds the battery by what it is
rather than by name, but I haven't built or run it. This sandbox
has no GTK headers and no batteries, so I could only check the
new detection function on its own. Please run `./compile` and
try it on a laptop that failed before.
**The cause:** On modern kernels the `/sys` branch of `main()`
only looks for `/sys/class/power_supply/BAT0`, then `BAT1`. If
neither exists, it logs "Abort, unable to open … BAT0 or BAT1"
and exits. Some laptops name the battery `CMB0`, `BATT`, `BATC`
or `macsmc-battery` (Apple Silicon), so the applet never starts
there.
**The fix:** I added `find_sys_battery()`, which scans
`/sys/class/power_supply/` and picks the first entry that:
- has `type` = `Battery`, which skips AC adapters and USB
supplies;
- isn't a peripheral battery (`scope` = `Device`), such as a
wireless mouse or keyboard;
- has a `capacity` file;
- has `present` not equal to 0. A battery that reports absent is
used only as a last resort, so a dual-battery machine with an
empty bay still works.
The discovered name replaces the hard-coded `BAT0`/`BAT1` paths.
I also fixed three nearby problems:
- **Click dialog:** it ran `cat
/sys/class/power_supply/BAT[01]/uevent`, so the
click-for-details popup would have been blank on those same
machines. It now uses the detected battery.
- **Crash on unreadable files:** `Update()` called `fgets` on a
possibly NULL file pointer. It now returns quietly, so the timer
stays alive if the battery is unplugged or unreadable.
- **"Not charging" status:** this status (some laptops report it
at a charge threshold) is now treated as not charging, so the
icon isn't shown as charging when it isn't.
Compiling the isolated function with `-Wall` gave only harmless
`snprintf` truncation warnings. They can't trigger, because
names of 64 characters or more are skipped first.
Files are in `/home/claude`:
- battery-detect.patch
- powerapplet_tray.c
I have compiled it and created powerapplet_tray version 3.3. It
works the same on my laptop, detects BAT0. Remains to be seen how
works on others such as Vverve's laptop.
Tags: easy
ROX-Filer thumbnails patch
In ROX-Filer there is an "eye" icon; right-click on it toggles thumbnails on/off for image and video files.
The problem is that sometimes not all the files are converted to thumbnails; have to toggle thumbnails off then on again, sometimes more than twice, to convert all of them.
I have asked Claude AI about this, and we had a to-and-fro
interaction, eventually had a patch that fixed it.
Previously, if an image file failed to convert to a thumbnail, it
prevented the rest of the image files in the window from being
converted. There is now a 3-second timeout for a conversion, then
conversion of the rest of the files will continue. Works
OK.
Tags: easy
Fix convert pup_event_ipc.bac to C
Yesterday I posted about using Claude AI to convert some utilities in the pup-tools package written in BaCon and nim to C:
- pup-tools utilities converted from bacon and nim to C — November 17, 2026
The BaCon utilities: welcome1stboot.bac, find_cat.bac, pup_event_ipc.bac
The nim utility: debdb2pupdb.nim
Don't actually use welcome1stboot anymore, nor, I think, find_cat; however, pup_event_ipc is an important part of the pup_event mechanism.
I compiled these C programs, and unfortunately pup_event_ipc does not work. Could probably work through it and find where it is going wrong; however, decided on a different approach. The BaCon compiler is not an actual compiler; it generates C code then calls gcc. So, I told the 'bacon' executable to create the C code only, then I made it into a tarball and provided it to Claude. I asked Claude:
Could you simplify this C code
What followed is quite remarkable. The C code created by bacon is very human-unreadable, so I was hoping that Claude could reduce it to something simpler and human-readable. It did. This is Claude's analysis:
I've rewritten the BaCon-generated code as one standalone
file, `pup_event_ipc.c`, about 186 lines. It builds with `cc -o
pup_event_ipc pup_event_ipc.c`. The original was roughly 1,850
lines spread over nine files, plus the BaCon runtime.
I compiled both versions and ran them side by side. They gave
the same output and exit codes for every case I tried:
- mailbox send, read and empty
- the `waitmail` timeout
- a bad format
- a request/reply exchange
- the keyword waits
**What changed**
- The `#line` markers, the BaCon string runtime, the
`select`/`CONCAT` machinery and the `exitsub`/`waitsub` wrappers
are gone.
- The help text is one string literal.
- The keyword handling is a small table: `block`, `dbus`,
`network`, `x`, `bluetoothhw`, `timeout1`, `timeout4`,
`timeout60` and `netchg` all wait on
`<keyword>_<client>`.
- The "Not implemented" branch is gone. It could never run,
because the file had just been created a few lines earlier.
- Cleanup is left to `exit`, which closes the file descriptors.
There's no explicit `inotify_rm_watch`.
- The timeout wait now uses `poll` in both cases, with an
infinite timeout when `-t` is 0, instead of a separate blocking
`read`.
**Behaviour that differs from the original**
- **`dbus`:** In the original it was missing from the keyword
list, so `dbus:x` wrote to file descriptor 0 (stdin). Now it
behaves like the other keywords. This is a guess at what the
author intended.
- **Error codes 3 and 4:** A failed `open` used to hit BaCon's
runtime error first, so the documented exit codes 3 and 4 never
happened. They now work as the help text says.
- **`-t` as the last argument:** It used to read past the end of
`argv`. Now it's ignored.
The client names go straight into
`/tmp/pup_event_ipc/<name>` with no check for `/`, same as
the original. That would allow path traversal if untrusted input
ever reaches it. I left it alone to keep behaviour identical,
but it's a one-line check if you want it.
The result is a single small C file, completely redesigned, using
some C functions that must be in libc, but I know nothing about
them. Anyway, it compiled, and it works. Haven't studied how it
works; for now, just happy that it does.
Tags: easy
gcc14 patch for ROX-Filer
ROX-Filer is compiled in woofQ2 and a PET created, that is used
in the EasyOS build. You can download the woofQ2 tarball to see
the source: it is old source dated 2011-10-22, with 22 patches.
It compiles ok in EasyOS, with gcc 14, with a lot of warnings, so I thought why not ask Claude AI? Blog post yesterday, reported on using Claude for the first time, converted some BaCon and nim coded utilities to C. Was very impressed with Claude -- and a bit worried how clever it is.
Decided why not ask Claude if can create a patch so ROX-Filer will compile cleanly with gcc14. Using the free Claude, uploaded rox source tarball, with the 22 patches already applied, and asked this:
Please create a patch so this code will compile cleanly with gcc 14 in linux
This is the reply:
This is ROX-Filer (GTK2). The sandbox has gcc 13 and no GTK2
headers, so I can’t do a full gcc 14 build. I’m statically
checking for the constructs gcc 14 turns into errors (implicit
declarations, int/pointer conversions) and fixing the configure
GCC-version check.
Still auditing: no GTK2/libxml headers here, so I’m checking the
likely gcc 14 error spots by hand (pointer-type mismatches on
gsize/len arguments, missing includes) and I’ve already found
the configure.in/configure GCC-version bug. Patch comes next.
I’ve made a patch (rox-filer-gcc14.patch), but I couldn’t
compile it. This sandbox has gcc 13 only, with no GTK2 or libxml
headers and no network to fetch them. It applies cleanly to your
tarball, and configure still passes a shell syntax check. Please
do a real build on your gcc 14 system to confirm.
I found one definite gcc 14 problem:
configure.in and configure: the GCC version check only matched
single-digit major versions ([5-9]). On gcc 10 and up, including
14, it fell through to the default branch. That branch skipped
-Wno-pointer-sign and -fno-stack-protector, so the build gets a
flood of pointer-sign warnings. The patch changes the pattern to
[5-9]|[1-9][0-9]. It edits both files because the generated
configure is in the tarball, so you don’t need to re-run
autoconf.
I also added includes that were missing as far as I could tell
by grep. Each one was reached only through other headers, so gcc
14’s stricter implicit-declaration errors could bite if those
paths change:
dir.c: <fcntl.h> for open/fcntl.
minibuffer.c and support.c: <strings.h> for strncasecmp.
xdgmimemagic.c: <wchar.h> for mbrtowc.
action.c: <sys/select.h> for select.
I also looked at hash-table and qsort callback signatures and
the int/pointer conversions I could find by grep, and found no
mismatches. If your gcc 14 build still stops with an error, send
me the compiler output and I’ll extend the patch.
filer.c.orig in the tarball differs from filer.c. I left it
alone, so it still sits in the source tree.
And Claude created 'rox-filer-gcc14.patch', that I added to
woofQ2, compiled rox; there was just one deprecated warning. Very
impresssed.
Tags: easy
Fix Easy Containers accelerated graphics checkbox
Chose "excalibur" container in the Manage tab, causes Expert tab
to be immediately set to the security settings for excalibur:

...however, "accel. graphics" checkbox wasn't getting set, it
should have been. Fixed in script
/usr/local/easy_containers/EC_SEC_INSERT
Tags: easy
pup-tools utilities converted from bacon and nim to C
pup-tools is a package with lots of little utilities that are used in EasyOS. Most are written in C; however, a couple are written in BaCon and one in nim language.
For a very long time I have wanted to convert them all to C; however, it is not easy, so just put it off. Until today; used AI for the first time.
Went to claude.ai, used the free version, online, gave it the BaCon and the nim programs and it converted them to C.
I was very surprised that Claude knows all about BaCon Basic, BaCON HUG (Highlevel Universal GUI), nim, even the Puppy Linux package format. It was actually quite scary how clever Claude was, analyzing the programs.
Now have pup-tools-20261117.tar.gz source, but cannot upload to ibiblio.org, as ibiblio is having some serious problem. Don't know what it is, tried to upload about 12 hours ago, again this evening, no go. support.ibiblio.org was working this morning, now broken, so can't even find it information about the breakage.
pup-tools was previously compiled in OpenEmbedded, for Scarthgap,
and I used that in the EasyOS Excalibur build. Now though, have
put pup-tools compile in woofQ2.
Tags: easy