i feel like this might have been already a solved problem with the chip in 2016 which had a direct plug for a lithium battery and had linux overlays to make it register like a laptop battery which almost every DE knows to report on the taskbar these days
you would think that anyone would have made something similar for the raspberry pi which is the most common of raspberry pis but i think in that regard the chip is still a better raspberry pi