2

I have the latest Pop!_OS 20.04. I recently I installed KDE Plasma on my machine.

The only thing that has been annoying me is once my battery gets low, and I plug in my charger, KDE takes almost half an hour to detect that. That basically means if I plug in at 10%, even when my machine is plugged in, KDE will shut the system down.

Note that plug in early or at 20% is not a desired solution.

12
  • 2
    What does sudo acpi -V return when you "plug in at 10%"? Jun 26, 2020 at 15:52
  • 1
    You can file a bug report here. Jun 26, 2020 at 17:47
  • 1
    I'd also recommend filing a bug report against KDE or Pop!_OS itself. Jun 26, 2020 at 17:52
  • 1
    @ParsaMousavi, consider making an answer. If you are lucky it will achieve score 2 and then the bounty is at least not lost (only to OP). I'd consider the reference to the bug report a decent insight to this question. Or maybe it attracts other answerers and provokes them into making a better one, maybe even with an actual solution. I don't think that OP can or should try to rescue the bounty that way however....
    – Yunnosch
    Jun 26, 2020 at 19:28
  • 2
    @ParsaMousavi Again, please consider making an answer. Even if not OP, you might receive upvotes from whoever finds help in your contribution. I do not really know, but maybe even the bounty can still be shifted and I would not mind. I would even make my own bounty and hand it over to you if your answer passes mine in score. Assumnig I get some kind of confirmation that it would not break any rules.
    – Yunnosch
    Jul 2, 2020 at 13:05

2 Answers 2

2
+50

(I am mostly doing this answer to provoke somebody else into making a better one to prevent me from earning the bounty undeservedly. Please make a better one. Please prefer upvoting any other answer than mine. As soon as I notice any answer with actual solution proposals I will happily delete mine. Otherwise let this answer get score 2, so as to at least avoid the frustration for OP that the reputation they lost is at least not completely lost...)

The discsussion in the comments has shown that there is no obvious mistake on OPs part.
Commenters agree that this is most likely a bug in KDE.

There now is a filed bug report by OP
https://bugs.kde.org/show_bug.cgi?id=423556#c1

And it seems that the bug has also already been reported just before.

If the question is not closed or deleted, this, the current status of the analysis, is the closest anybody can get to an answer.

0
1

I wrote an applet for KDE Plasma 5 which shows the battery percentage based on the /sys interface (which gets updated instantly and hasn't the delay of UPower daemon or the Battery and Brightness plasmoid).

/sys is in fact an interface for accessing the kernel data structures at runtime.It resides completely on memory and is a useful source of debugging information.The information that we need here is the exact battery percentage:

$ tree /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/
.
├── alarm
├── capacity
├── capacity_level
├── cycle_count
├── device -> ../../../PNP0C0A:00
├── energy_full
├── energy_full_design
├── energy_now
├── hwmon1
│   ├── device -> ../../BAT0
│   ├── in0_input
│   ├── name
│   ├── power
│   │   ├── async
│   │   ├── autosuspend_delay_ms
│   │   ├── control
│   │   ├── runtime_active_kids
│   │   ├── runtime_active_time
│   │   ├── runtime_enabled
│   │   ├── runtime_status
│   │   ├── runtime_suspended_time
│   │   └── runtime_usage
│   ├── subsystem -> ../../../../../../../../../../class/hwmon
│   ├── temp1_label
│   ├── temp2_label
│   └── uevent
├── manufacturer
├── model_name
├── power
│   ├── async
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_kids
│   ├── runtime_active_time
│   ├── runtime_enabled
│   ├── runtime_status
│   ├── runtime_suspended_time
│   └── runtime_usage
├── power_now
├── present
├── serial_number
├── status
├── subsystem -> ../../../../../../../../../class/power_supply
├── technology
├── type
├── uevent
├── voltage_min_design
└── voltage_now

For example the number that we're looking for resides under this file(in my system):

/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/capacity

It shows the correct percentage of the battery (BAT0):

enter image description here

The responsibility of this plasmoid is to read that number regularly every three seconds.


Here's the project repository: https://gitlab.com/P.Mousavi/batperc-indicator
And if you wanted to compile and run it, follow the instructions below:

Install the dependencies(explained in README.md) and run:

git clone https://gitlab.com/P.Mousavi/batperc-indicator.git
cd batperc-indicator
mkdir build
cd build
qmake ../plugin/
make
sudo make install

If all goes without any error then you should be able to see the plasmoid Battery percentage indicator in the widgets side-bar in KDE Plasma and you can drag-n-drop it from there.

There are a lot of TODOs like changing the color when the percentage goes below a threshold etc.But for now I'm busy :)

Hope it helps.

3
  • 2
    It seems you really achieved something there. However, based on my experience on StackOverflow, an answer will not really be considered an answer as long as practically all of the solution is only linked. (I am not presuming familiarity with this sister site, so I am not going to flag. But I think there is a certain risk that others will do so.) If you describe the basic principle of how you achieved the solution directly here, just as a summary, then I expect you will harvest some upvotes. Everybody else in this community, please let me know if I am wrong, e.g. by upvoting as is.... ;-)
    – Yunnosch
    Jul 6, 2020 at 11:15
  • Note, I do see the "based on the /sys interface (which gets updated instantly and hasn't the delay of UPower or the Battery and Brightness plasmoid)." For me that is more of a description what it achieves, less of how. Maybe that is only because I lack technical knowhow.
    – Yunnosch
    Jul 6, 2020 at 11:18
  • 1
    @Yunnosch Your statement about "being considered as an answer" holds true here too.And I updated my post with additional explanations about how it works.But everything else about that is just implementation detail and I think is inappropriate and off-topic here.However thanks for your feedback :) Jul 6, 2020 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.